I have created a urls
and views
folder, like templates
, but it is not working.
I am getting error:
Exception Value: No module named urls
Here's what my project looks like:
requirements.txt:
Django==1.6.5
pymongo==2.8
.
├── DjangoProject
│ ├── DjangoProject
│ │ ├── app
│ │ │ ├── __init__.py
│ │ │ ├── __init__.pyc
│ │ │ ├── models.py
│ │ │ ├── models.pyc
│ │ │ ├── templates
│ │ │ ├── tests.py
│ │ │ ├── urls
│ │ │ │ └── test.py
│ │ │ └── views
│ │ │ └── test.py
│ │ ├── __init__.py
│ │ ├── __init__.pyc
│ │ ├── settings.py
│ │ ├── settings.pyc
│ │ ├── urls.py
│ │ ├── wsgi.py
│ │ └── wsgi.pyc
│ └── manage.py
└── requirements.txt
settings.py file :
INSTALLED_APPS = (
'DjangoProject.app',
........
)
ROOT_URLCONF = 'DjangoProject.app.urls'
DjangoProject/urls.py :
urlpatterns = patterns('',
url(r'^$', include('DjangoProject.app.urls')),
url(r'^admin/', include(admin.site.urls)),
)
app/urls/test.py :
from django.conf.urls import patterns, url
urlpatterns = patterns('DjangoProject.app.views.test',
url(r'^/create/$','first_view',name='first_view'),
)
app/views/test.py :
from django.shortcuts import render, render_to_response
from django.http import HttpResponse
from django.template import loader
from django.template import RequestContext
def first_view(request):
return HttpResponse("Hi")