Django 2.0 tutorial

309 views
Skip to first unread message

Carl Brubaker

unread,
Nov 23, 2017, 9:33:35 AM11/23/17
to Django users
I am brand new to Python and Django. I am trying to learn both simultaneously. I wanted to run the Django tutorial to make sure it works on my computer, iMac running 10.13.1.

I know I have coding issues, and managed to figure out some of the problems that I had, but the polls tutorial does not work.

Things I have figure out:

   Don't type "python", use "python3".
       - Since 2.0 only works in Python 3, shouldn't the tutorial be updated to that? Or is that just because I have a Mac that comes preinstalled with Python 2?

   Add "from django.conf.urls import include" to mysite/urls.py
        - Again, not mentioned in the tutorial.

I no longer have errors in my terminal, but the "polls" website is not found in my browser.

   Error in the browser:
    

     Page not found (404)

       Request Method: GET
       Request URL: http://localhost:8000/polls

      Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:

  1.  polls/
  2. admin/

      The current path, polls, didn't match any of these.


   Error in the terminal

      python3 manage.py runserver
      Performing system checks...

      System check identified no issues (0 silenced).

      You have 14 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
      Run 'python manage.py migrate' to apply them.

      November 23, 2017 - 10:13:03
      Django version 2.0rc1, using settings 'mysite.settings'
      Starting development server at http://127.0.0.1:8000/
      Quit the server with CONTROL-C.
      Not Found: /polls
      [23/Nov/2017 10:13:09] "GET /polls HTTP/1.1" 404 2060

I'm trying to look through issues from previous versions to see if I get lucky. Any help would be greatly appreciated.

Carl Brubaker

unread,
Nov 23, 2017, 10:58:39 AM11/23/17
to Django users
Correction - The "import include" was mentioned in the tutorial, I missed it.

I still need help!

Gerardo Palazuelos Guerrero

unread,
Nov 23, 2017, 10:59:42 AM11/23/17
to django...@googlegroups.com
if the tutorial is not updated to django 2, then stick and install django 1.11

I´m a beginner too, and I was able to complete the django-girls tutorial; which is awesome for beginners

good luck.

--
Gerardo Palazuelos Guerrero


--
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/30dccdd4-1de1-44d0-b6e8-a9d6bb705fcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lachlan Musicman

unread,
Nov 23, 2017, 4:51:53 PM11/23/17
to django...@googlegroups.com


------
"The antidote to apocalypticism is apocalyptic civics. Apocalyptic civics is the insistence that we cannot ignore the truth, nor should we panic about it. It is a shared consciousness that our institutions have failed and our ecosystem is collapsing, yet we are still here — and we are creative agents who can shape our destinies. Apocalyptic civics is the conviction that the only way out is through, and the only way through is together. "

Greg Bloom @greggish https://twitter.com/greggish/status/873177525903609857

On 23 November 2017 at 21:16, Carl Brubaker <itsbette...@gmail.com> wrote:

I am brand new to Python and Django. I am trying to learn both simultaneously. I wanted to run the Django tutorial to make sure it works on my computer, iMac running 10.13.1.

      You have 14 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
      Run 'python manage.py migrate' to apply them.

      November 23, 2017 - 10:13:03
      Django version 2.0rc1, using settings 'mysite.settings'
      Starting development server at http://127.0.0.1:8000/
      Quit the server with CONTROL-C.
      Not Found: /polls
      [23/Nov/2017 10:13:09] "GET /polls HTTP/1.1" 404 2060



Did you apply the migration?


"
      You have 14 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
      Run 'python manage.py migrate' to apply them.

"

Run the migration first.

Then try again.

Cheers
L.

 

Carl Brubaker

unread,
Nov 23, 2017, 8:15:05 PM11/23/17
to Django users
Ok, I applied the migration, but it still doesn't work. Maybe this is a django 2.0 bug that needs worked out. I figured I'd learn 2.0 so I wouldn't have to relearn after 2.0 releases. The initial check before creating the "polls app" worked, but it can never find the address. Still need more help. Thanks!

Gerardo Palazuelos Guerrero

unread,
Nov 23, 2017, 9:19:47 PM11/23/17
to django...@googlegroups.com
Hi Carl,
Please check the Django girls. They have very goods lectures for beginners.

---
Gerardo Palazuelos
Enviado desde mi iPhone


El 23/11/2017, a las 18:15, Carl Brubaker <itsbette...@gmail.com> escribió:

Ok, I applied the migration, but it still doesn't work. Maybe this is a django 2.0 bug that needs worked out. I figured I'd learn 2.0 so I wouldn't have to relearn after 2.0 releases. The initial check before creating the "polls app" worked, but it can never find the address. Still need more help. 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.

Lachlan Musicman

unread,
Nov 23, 2017, 10:48:33 PM11/23/17
to django...@googlegroups.com
On 24 November 2017 at 12:15, Carl Brubaker <itsbette...@gmail.com> wrote:
Ok, I applied the migration, but it still doesn't work. Maybe this is a django 2.0 bug that needs worked out. I figured I'd learn 2.0 so I wouldn't have to relearn after 2.0 releases. The initial check before creating the "polls app" worked, but it can never find the address. Still need more help. Thanks!

I didn't expect the migration to solve your problems - but it solved other problems you didn't seem to note that you had.

You need to have two urls.py - one in the polls (orr app) directory and one in the project directory - what ever you called your original project in which the polls app.

do you have a myproject/polls/urls.py *and* myproject/myproject/urls.py?

Does the myproject/polls/urls.py look like the first urls.py shown under https://docs.djangoproject.com/en/2.0/intro/tutorial01/#write-your-first-view
Does the myproject/myproject/urls.py look like the second urls.py shown under here https://docs.djangoproject.com/en/2.0/intro/tutorial01/#write-your-first-view

Once they do look like this - have you restarted the runserver?

L.


 

Carl Brubaker

unread,
Nov 24, 2017, 8:10:46 AM11/24/17
to Django users
I figured it out. I had a space in between the "path(' '," single quotes in the polls.urls and there isn't supposed to be one. Thanks for all of your help.
Reply all
Reply to author
Forward
0 new messages