django-admin creates the views.py files in the wrong place!

53 views
Skip to first unread message

Aliane Abdelouahab

unread,
Oct 22, 2014, 5:05:07 PM10/22/14
to django...@googlegroups.com
Hi,
Django 1.7 when a beginner runs the first tutorial, he has to change the views.py file outside the app to the whole project itself.
i found this, http://stackoverflow.com/questions/22011791/importerror-no-module-named-views and it seems it is related to Django 1.6 too?

Daniel Roseman

unread,
Oct 23, 2014, 7:22:27 AM10/23/14
to django...@googlegroups.com
No, there is no need to move any views files. What makes you think there is? Please show exactly what you have done and any errors you receive.
--
DR.

Aliane Abdelouahab

unread,
Oct 23, 2014, 10:34:15 AM10/23/14
to django...@googlegroups.com
i followed exactly by words the tutorial
and it seems the problem is about creating the double directory, and when doing startapp it creates a directory parallel to the other one created?

Daniel Roseman

unread,
Oct 23, 2014, 11:53:07 AM10/23/14
to django...@googlegroups.com
Sorry, I've no idea what you mean. `startproject` will create the outer project directory and the inner settings/urls directory, but doesn't create any views. `startapp` will create another directory, inside the project directory, containing views and models. None of these need moving anywhere.
--
DR.

Aliane Abdelouahab

unread,
Oct 23, 2014, 4:45:18 PM10/23/14
to django...@googlegroups.com
Try the code like that, it will not work,

now move the views.py from /rango to the initial directory where the is the manage.py (/abdou) and it will work
abdou.zip

Daniel Roseman

unread,
Oct 23, 2014, 5:18:41 PM10/23/14
to django...@googlegroups.com
On Thursday, 23 October 2014 21:45:18 UTC+1, Aliane Abdelouahab wrote:
Try the code like that, it will not work,

now move the views.py from /rango to the initial directory where the is the manage.py (/abdou) and it will work

Nope; that is the correct structure, as it is, with no need to move anything. The problem is not with the structure, but with your rango/urls.py: you did not follow the instructions correctly, and have 'views.index' in quotes, rather than referring directly to the function as shown in section 4.5 of the Tango docs.
--
DR.

Aliane Abdelouahab

unread,
Oct 23, 2014, 5:25:23 PM10/23/14
to django...@googlegroups.com
oh! sorry :D i was dumb! how can i missed this!
thank you again!
Reply all
Reply to author
Forward
0 new messages