Hi Syed,
On Wednesday, June 20, 2018 at 5:12:49 AM UTC-4, Django starter wrote:
-- Take a look at this part of the error:
File "/home/ssyed/polls/bin/mysite/mysite/urls.py", line 20, in <module>
path('polls/', include('polls.urls')),
NameError: name 'include' is not defined
It appears that you have missed the addition of 'include' in your urls.py file. The tutorial shows the following, below - does this match your urls.py file contents? Note the line from django.urls import include, path
From the tutorial:
The next step is to point the root URLconf at the polls.urls
module. In mysite/urls.py
, add an import for django.urls.include
and insert an include()
in the urlpatterns
list, so you have:
mysite/urls.py
from django.contrib import admin from django.urls import include, path urlpatterns = [ path('polls/', include('polls.urls')), path('admin/', admin.site.urls), ]
On Wednesday, June 20, 2018 at 5:12:49 AM UTC-4, Django starter wrote:
Hi,I have tried my best to do this as good as possible, but i still encountered the error.ERROR :(polls) ssyed@ssyed:~/polls/bin/mysite$ python manage.py runserver Performing system checks...Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f996a794598>Traceback (most recent call last):File "/home/ssyed/polls/lib/python3.6/site-packages/ django/utils/autoreload.py", line 225, in wrapper fn(*args, **kwargs)File "/home/ssyed/polls/lib/python3.6/site-packages/ django/core/management/ commands/runserver.py", line 120, in inner_run self.check(display_num_errors=True) File "/home/ssyed/polls/lib/python3.6/site-packages/ django/core/management/base. py", line 364, in check include_deployment_checks=include_deployment_checks, File "/home/ssyed/polls/lib/python3.6/site-packages/ django/core/management/base. py", line 351, in _run_checks return checks.run_checks(**kwargs)File "/home/ssyed/polls/lib/python3.6/site-packages/ django/core/checks/registry. py", line 73, in run_checks new_errors = check(app_configs=app_configs)File "/home/ssyed/polls/lib/python3.6/site-packages/ django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver)File "/home/ssyed/polls/lib/python3.6/site-packages/ django/core/checks/urls.py", line 23, in check_resolver return check_method()File "/home/ssyed/polls/lib/python3.6/site-packages/ django/urls/resolvers.py", line 399, in check for pattern in self.url_patterns:File "/home/ssyed/polls/lib/python3.6/site-packages/ django/utils/functional.py", line 36, in __get__ res = instance.__dict__[self.name] = self.func(instance)File "/home/ssyed/polls/lib/python3.6/site-packages/ django/urls/resolvers.py", line 540, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)File "/home/ssyed/polls/lib/python3.6/site-packages/ django/utils/functional.py", line 36, in __get__ res = instance.__dict__[self.name] = self.func(instance)File "/home/ssyed/polls/lib/python3.6/site-packages/ django/urls/resolvers.py", line 533, in urlconf_module return import_module(self.urlconf_name) File "/home/ssyed/polls/lib/python3.6/importlib/__init__. py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_importFile "<frozen importlib._bootstrap>", line 971, in _find_and_loadFile "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>", line 665, in _load_unlockedFile "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removedFile "/home/ssyed/polls/bin/mysite/mysite/urls.py", line 20, in <module> path('polls/', include('polls.urls')),NameError: name 'include' is not definedTREE STRUCTURE :(polls) ssyed@ssyed:~/polls/bin/mysite$ tree .├── db.sqlite3├── manage.py├── mysite│ ├── __init__.py│ ├── __pycache__│ │ ├── __init__.cpython-36.pyc│ │ ├── settings.cpython-36.pyc│ │ ├── urls.cpython-36.pyc│ │ └── wsgi.cpython-36.pyc│ ├── settings.py│ ├── urls.py│ └── wsgi.py└── polls├── admin.py├── apps.py├── __init__.py├── migrations│ └── __init__.py├── models.py├── tests.py├── urls.py└── views.pyOn Tue, Jun 19, 2018 at 8:57 PM, itsnate_b <nathan...@gmail.com> wrote:Syed,--I really suggest you follow the Django Tutorial found here: https://docs.djangoproject.com/en/2.0/ intro/tutorial01/
Go through all of the parts of the tutorial (there are 7 parts), line by line. Start with a completely new project. Jumping in and out of other tutorials is really not recommended (my 2 cents). I followed through all parts of the tutorial when I first started and found it to be a really great starting point. The documentation is very well written.I really can't help you if you are jumping around between different sites/tutorials. Start one and follow through all the way to the end.Good luck!
On Tuesday, June 19, 2018 at 7:14:13 AM UTC-4, Django starter wrote:Hi Nathan,I am really confused starting up with my websitei have gone through couple of Videos and sites to start with,in one of the sites, it was mentioned to make changes in urls.py and then in views.py and in settings.py [Installed Apps] to have the site worked.unfortunately i dont see views.pybelow is the tree(el) ssyed@ssyed:~/el/bin$ tree.├── activate├── activate.csh├── activate.fish├── activate_this.py├── chardetect├── django-admin├── django-admin.py├── easy_install├── easy_install-3.6├── elastic│ ├── db.sqlite3│ ├── DJango│ ├── elastic│ │ ├── __init__.py│ │ ├── __pycache__│ │ │ ├── __init__.cpython-36.pyc│ │ │ ├── settings.cpython-36.pyc│ │ │ ├── urls.cpython-36.pyc│ │ │ └── wsgi.cpython-36.pyc│ │ ├── settings.py│ │ ├── urls.py│ │ └── wsgi.py│ └── manage.pyCould you please help me know if i am going in the right way.ThanksSYEDOn Mon, Jun 18, 2018 at 11:50 PM, itsnate_b <nathan...@gmail.com> wrote:To view this discussion on the web visit https://groups.google.com/d/No problem. Good luck!--
On Monday, June 18, 2018 at 12:46:23 PM UTC-4, Django starter wrote:Hi Nathan,Appreciate your response, it wasnt there,I would create it again and check and thanks a lot for respondingOn Mon, Jun 18, 2018 at 11:43 PM, itsnate_b <nathan...@gmail.com> wrote:I'm assuming you already did this?--
django-admin startproject mysite
If so, then you should have a mysite folder, inside of another mysite folder. Inside of there you should have views.py, models.py. You may need to create the urls.py file, if it's not already there.
should look like what is shown in the tutorial...mysite/ manage.py mysite/ __init__.py settings.py urls.py wsgi.py
On Monday, June 18, 2018 at 8:26:42 AM UTC-4, Django starter wrote:I am trying to create polls project as mentiioned in the django website, i am a beginer of django, as mentioned in the https://docs.djangoproject.com/en/dev/ intro/tutorial01/ i dont see mysite/urls.py, do i need to create mysite and urls.py, could you please let me know.Thanks
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...@googlegroups.com .
To post to this group, send email to django...@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/2389c312- .9fa1-4314-8266-cce998cea3cb% 40googlegroups.com
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...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .msgid/django-users/b41e988b- .e70b-413e-aed6-8ce0d51bc906% 40googlegroups.com
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...@googlegroups.com .
To post to this group, send email to django...@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/07e44626- .4114-4821-bc56-d71771166e10% 40googlegroups.com
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/1966a615-42b8-4c90-8539-ba2be1fd654c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment