Monday, November 26, 2018

Re: how to fix this problem using 2.1.3 version

# from django.conf.urls import patterns, url
from django.conf.urls.static import static
from django.views.generic import ListView
from restaurants.models import Food
from django.conf import settings

urlpatterns = ('restaurants.views',
path('',ListView.as_view(model=Food, template_name='restaurants/index.html', name='index'),
path('food/(?P<food_id>\d+)/',
'choose_town', name='choose_town'),
path('food/(?P<food_id>\d+)/town/(?P<town_id>\d+)/',
'choose_restaurant',
name='choose_restaurant'),
path('rest/(?P<rest_id>\d+)/',
'restaurant',
name='restaurant'),
path('(?P<rest_id>\d+)/vote/',
'vote',
name='vote'),
)


if settings.DEBUG:
urlpatterns += patterns('',
('media/(?P.*)',
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}))

On Mon, Nov 26, 2018 at 5:47 AM Yavin Aalto Arba <yavinarba@gmail.com> wrote:
did you import settings?

On Mon, 26 Nov 2018 at 15:34, Abba Haruna <abbamuhd0@gmail.com> wrote:
if settings.DEBUG:
# urlpatterns += patterns('',
# ('media/(?P.*)',
# 'django.views.static.serve',
# {'document_root': settings.MEDIA_ROOT})) 



this is the result 

 File "C:\Users\Abba\Desktop\rest_picker\restaurants\urls.py", line 22
    if settings.DEBUG:
                     ^
SyntaxError: invalid syntax


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9f08ad47-6d28-44ef-ba8c-7bfbb9aca8be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/syLm4GpiFqg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%2Be-ZX%3DkfFRPBe_edkvQg1vD3F89FUrHfQ-JOKpR793zHS4qA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL67j7Gk5G0FKfMK3P7NX2PfrS7C_-88GE-5nRUm%2BtURcLtBqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment