Saturday, April 23, 2011

Problems with running Hello world app, urls.py probably ignored

Hello guys,

I have searched to solve this for a whole evening without any results.
I have read all known "my first app in django" tutorials, but my test
app just isn't working.

I have project called "john". In it's directory I have app package
"dashboard" containing init, models, tests and views. Moreover, in
project directory "john" are init, manage, settings and urls files. My
urls.py:

from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('john',
(r'^$', 'dashboard.views.hello'),
(r'^hello/$', 'dashboard.views.hello'),
)

My dashboard/views.py:

from datetime import datetime
from django.http import HttpResponse
def hello(request):
return HttpResponse(datetime.now().strftime('%H:%M:%S'))

My settings.py (not complete, I copied only apparently important
parts):

ROOT_URLCONF = 'emil.urls'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
)

Now what is the problem. If I go to my "john" directory and I launch
server, it looks like this:

.../john$ python manage.py runserver
Validating models...
0 errors found
Django version 1.3, using settings 'john.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[23/Apr/2011 14:40:31] "GET / HTTP/1.1" 200 2047
[23/Apr/2011 14:40:38] "GET / HTTP/1.1" 200 2047

but if I go to the browser and I type http://127.0.0.1:8000/ or
http://127.0.0.1:8000/hello, it shows me Django welcome screen (It
worked! ... you haven't configured any URLs.). According to it's text
I assume it completely ignores what I have configured in urls.py. I
can't get over this screen, I haven't seen any 404 yet or anything
else. Welcome screen is the most far place I managed to get in half of
a day spent with Django :(

Thanks for any help,

Honza Javorek

--
You received this message because you are subscribed to the Google Groups "Django users" group.
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


Real Estate