New to Django (stuck at the end of the tutorial)

117 views
Skip to first unread message

Cronos Cto

unread,
Apr 26, 2016, 3:33:09 AM4/26/16
to Django users


Hello Django Lovers.

So I started on Django as project of mine. Seems like a great first framework to start on. At the moment I am stuck at this:


This was after what I encountered at the end of the Django oficial post app tutorial.

I tried several ways to solve it. The problem seems to lay in the url.py file, but I can not seem to solve it.


Thank you to anyone that can help me solve it.

Cristiano Valente

unread,
Apr 26, 2016, 9:33:54 AM4/26/16
to Django users
You have defined no view to handle the root url. You only have two routes: ^/sistema and ^/admin.
Besides, you should wrap admin.site.url in an include().

Nikhil Beniwal

unread,
Apr 26, 2016, 12:33:40 PM4/26/16
to Django users
The Problem is in your line 21. 

admin.site.urls should be wrapped inside include like :-

url(r'^admin/', include(admin.site.urls)),

knbk

unread,
Apr 26, 2016, 2:08:15 PM4/26/16
to Django users
Since 1.9, admin.site.urls is a special case, and you should not use include(). If you do, you'll trigger some deprecation warnings due to changes to include().
Message has been deleted

Cronos Cto

unread,
Apr 26, 2016, 3:14:01 PM4/26/16
to Django users
I have tried the include solution. Just creates more erros as knbk said.

Patrick Harding

unread,
Apr 26, 2016, 5:49:08 PM4/26/16
to Django users
maybe giving it a namespace would handle it for you? such as ....
 include('sistema.urls', namespace='sistema')

if not you can try this. the error i get is that you should "pass the callable instead" which means in your imports include the views that you want to import, then call them in you url statements.
for example:

from .views import (
    post_list,
    post_create,
    post_detail,
    post_update,
    post_delete,
    )

urlpatterns = [
    url(r'^$', post_list, name='list'),
    url(r'^create/$', post_create, name='create'),
    url(r'^(?P<id>\d+)/$', post_detail, name='detail'),
    url(r'^(?P<id>\d+)/edit/$', post_update, name='update'),
    url(r'^(?P<id>\d+)/delete/$', post_delete, name='delete'),


]

here you are calling the view, then giving it a name that will show up in the URL.

Cronos Cto

unread,
Apr 26, 2016, 7:56:19 PM4/26/16
to Django users

´


Doesnt seem to fix it still. I have no clue how to go further, totally new to django.



Vijay Khemlani

unread,
Apr 26, 2016, 8:07:09 PM4/26/16
to django...@googlegroups.com
You still haven't defined a rule to handle the root path, just admin and sistema

On Tue, Apr 26, 2016 at 8:56 PM, Cronos Cto <cron...@gmail.com> wrote:

´


Doesnt seem to fix it still. I have no clue how to go further, totally new to django.



--
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/64ae0a3f-7138-4a4b-8fbb-817192f55207%40googlegroups.com.

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

Cronos Cto

unread,
Apr 26, 2016, 8:58:38 PM4/26/16
to Django users
Could you give me an example or so Vijay Khemali?

Nikhil Beniwal

unread,
Apr 27, 2016, 3:56:38 AM4/27/16
to Django users
You can define it like :-
url(r'^$', 'apps_name.views.home', name='home'),

Mie Rex

unread,
Apr 27, 2016, 10:02:56 PM4/27/16
to Django users
I had a smiliar problem with another Django tutorial.

I was running Django with Anaconda environment and I took the advice from "Two Scoop Django" to have all projects stored in one directory and all the environment in another.  Therefore the project "mysite" was initialized and put in a folder, which was parallel to the environment folder.
I fixed all the problem by initializing the project inside the environment used for Django.

Took me 3 days to figure out what was the problem.
Hope you could figure out how to fix that soon.
Cheers

Cronos Cto

unread,
Apr 28, 2016, 1:14:35 PM4/28/16
to Django users
Nikhil Beniwal , I tried I get an error that says __init__() takes 1 positional argument but 2 were given.

I don't understand, I must be doing something wrong since this was done with the help of the Django official tutorial.

Mie Rex

unread,
Apr 30, 2016, 1:34:33 AM4/30/16
to Django users
I just did another try with a different version of Django which is same version of Django used in the book I am reading.
It turns out where the project(mysite) saved has no effect on it.  I think it's how Django suppose to behave.
Perhaps you are not working with the same version of Django as the tutorial??

The sense of achievement is great once the view function starts to working and progress are being made.
I hope you could figure out your problem soon.
Cheers~

Mie Rex於 2016年4月27日星期三 UTC-7下午7時02分56秒寫道:

Aaron Poncé

unread,
Apr 30, 2016, 5:39:31 AM4/30/16
to Django users
Just a related/unrelated sidenote.. I'm also new to Django and I found an amazing tutorial series on youtube... Just wanted to share it with you: 


It's a 12 part series and it really helped me get the ball rolling

Cronos Cto

unread,
May 1, 2016, 9:12:37 PM5/1/16
to Django users
Ty Aeron I will check it out.
Reply all
Reply to author
Forward
0 new messages