Re: Cant Import mysite.urls
Thanks, Patrick. My reference to utils.py should have been to urls.py, which I have in my mysite app package.
I'm seeing this import error on mysite.urls when I'm attempting to get Apache + mod_wsgi to serve my app. I don't remember seeing this error with the development server when I first tried out the tutorials. Probably got my configs wrong, somewhere in my second try.
I'll start a new app, now that I know a little bit more about how this all works. It's a steep learning curve!
On Tuesday, September 11, 2012 10:59:02 AM UTC+10, patrick wrote:
On Monday, September 10, 2012 8:29:12 PM UTC-3, Jon Blake wrote:--Working through getting Django to work with Apache, mod_wsgi and Oracle database back end. When I enter my site URL, I get a "ImportError at /" page, with an exception value of "No module named mysite.urls".
Part 3 of the tutorial refers to line ROOT_URLCONF = 'mysite.urls', which I have in my settings.py module. I don't have a file mysite.urls. The tutorial then goes on to discuss editing utls.py, (which I do have) and states that Django will load this module (utils.py) because ROOT_URLCONF points to it. I don't understand that bit - what's the connection between mysite.urls and utils.py, and how does Django import mysite.urls if it does not exist?It can be a bit confusing the first time you run into it, but "mysite.urls" isn't a file. It's a namespaced import path. So in this case, it is looking for an urls.py file in the mysite directory.In the tutorial it's assumed that you named your project mysite. If you called it something else (say tutorial), the import path would be "tutorial.urls".If you are using Django 1.4 and followed the tutorial by using the django-admin.py startproject command (which builds a project skeleton for you), the urls.py file should be in the same directory as your settings.py file.I couldn't find a reference to utils.py in the tutorial so I assume it must be an accidental typo and probably the cause of the error you're seeing.
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/C02LpMhCyaAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home