I am trying to create polls project as mentiioned in the django website

38 views
Skip to first unread message

Django starter

unread,
Jun 18, 2018, 8:26:42 AM6/18/18
to Django users
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

itsnate_b

unread,
Jun 18, 2018, 12:43:02 PM6/18/18
to Django users
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

Sujad Syed

unread,
Jun 18, 2018, 12:46:23 PM6/18/18
to django...@googlegroups.com
Hi Nathan,

Appreciate your response, it wasnt there, 

I would create it again and check and thanks a lot for responding

--
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...@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.

For more options, visit https://groups.google.com/d/optout.

itsnate_b

unread,
Jun 18, 2018, 12:50:47 PM6/18/18
to Django users
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 responding
On 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.

Aditya Singh

unread,
Jun 18, 2018, 12:54:02 PM6/18/18
to django...@googlegroups.com
Hello mate,
Since you are in the beginning stages I would suggest that you start a new project and check the urls.py again inside the project directory. If not let us know!
Kind Regards,
Aditya

Sujad Syed

unread,
Jun 19, 2018, 7:14:13 AM6/19/18
to django...@googlegroups.com
Hi Nathan,

I am really confused starting up with my website

i 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.py

below 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.py


Could you please help me know if i am going in the right way.

Thanks
SYED


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...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

itsnate_b

unread,
Jun 19, 2018, 9:57:58 AM6/19/18
to Django users
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!

Sujad Syed

unread,
Jun 20, 2018, 5:12:49 AM6/20/18
to django...@googlegroups.com
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_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/ssyed/polls/bin/mysite/mysite/urls.py", line 20, in <module>
    path('polls/', include('polls.urls')),
NameError: name 'include' is not defined



TREE 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.py



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...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

itsnate_b

unread,
Jun 20, 2018, 11:21:09 AM6/20/18
to Django users
Hi Syed,
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),
]
Reply all
Reply to author
Forward
0 new messages