2

As this other SO post shows, my Django 1.4 directory structure globally looks like:

wsgi/
   champis/
       settings.py
       settings_deployment.py
       urls.py
   site/
       static/
           css/
               app.css
       templates/some_app/foo.html
       __init__.py
       urls.py
       views.py
       models.py
   manage.py

The project is champis, the app is site. My PYTHONPATH includes the wsgi folder (well from Django standards it should be named after the project i.e. champis, but here I'm starting from an Openshift django-example Git project).

My champis.urls:

from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^champis/', include('site.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

My site.urls module then routes to specific pages, but when trying to access on local, I have the error:

http://127.0.0.1/champis => no module name site.urls

The site app is present in my INSTALLED_APPS, and my ROOT_URLCONF is champis.urls. Do you have an idea why ? Even moving the site folder into the champis one didn't help.

Community
  • 1
  • 1
Emmanuel
  • 13,935
  • 12
  • 50
  • 72

1 Answers1

1

I finally managed to solve this problem by:

  • adding an __init__.py at project level
  • renaming my site app into web (app name seemed to be colliding with... something that I did not find)

Here is my current directory structure now:

wsgi/
   champis/
       settings.py
       settings_deployment.py
       urls.py
   web/                <= changed app name
       static/
           css/
               app.css
       templates/some_app/foo.html
       __init__.py
       urls.py
       views.py
       models.py
   manage.py
   __init__.py         <= added
Emmanuel
  • 13,935
  • 12
  • 50
  • 72