settings.py, so you can have a traceback of what is happening. If you
still don't have a clue, post the traceback.
H.
Hector Garcia - Web developer, musician
http://nomadblue.com/
On Tue, Jul 27, 2010 at 11:13 AM, yalda.nasirian
<yalda.nasirian@gmail.com> wrote:
> hi ,please help me , i realy dont know what can i do for this error i
> cant see my web page .
> another question : i have datetime error (i import date time in shell
> but this error exist )
> tanx
> please help ! error
> Page not found
>
> We're sorry, but the requested page could not be found.
> [27/Jul/2010 03:48:34] "GET / HTTP/1.1" 404 1612
>
> my setting.py :
>
> DEBUG = False
> TEMPLATE_DEBUG = False
> SEND_BROKEN_LINK_EMAILS = False
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'sqlite3', # Add 'postgresql_psycopg2',
> 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'db.dev', # Or path to database
> file if using sqlite3.
> 'USER': '', # Not used with sqlite3.
> 'PASSWORD': '', # Not used with sqlite3.
> 'HOST': '', # Set to empty string for
> localhost. Not used with sqlite3.
> 'PORT': '', # Set to empty string for
> default. Not used with sqlite3.
> }
> }
> TIME_ZONE = 'America/Chicago'
>
> SITE_ID = 1
>
> USE_I18N = True
>
> USE_L10N = True
>
> MEDIA_ROOT = ''
>
> MEDIA_URL = ''
>
> ADMIN_MEDIA_PREFIX = '/media/'
>
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.Loader',
> 'django.template.loaders.app_directories.Loader',
> # 'django.template.loaders.eggs.Loader',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> )
>
> ROOT_URLCONF = 'mysite.urls'
>
> TEMPLATE_DIRS = (
> '/home/yalda/Desktop/mytemplates'
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.admin',
> 'samir',
> )
> my urls :
> from django.conf.urls.defaults import *
> from django.contrib import admin
> admin.autodiscover()
> handler404 = 'django.views.defaults.page_not_found'
> handler500 = 'django.views.defaults.server_error'
> urlpatterns = patterns('mysite.samir.views',
> (r'^polls/$', 'index'),
> (r'^polls/(?P<poll_id>\d+)/$', 'detail'),
> (r'^polls/(?P<poll_id>\d+)/results/$', 'results'),
> (r'^polls/(?P<poll_id>\d+)/vote/$', 'vote'),
> )
> my models :
> from django.db import models
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> def was_published_today(self):
> return self.pub_date.date() == datetime.date.today()
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
> def __unicode__(self):
> return self.choice
>
> my view :
>
> from django.shortcuts import render_to_response, get_object_or_404
> from mysite.samir.models import Poll
>
> def index(request):
> latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5]
> return render_to_response('polls/index.html', {'latest_poll_list':
> latest_poll_list})
>
> def detail(request, poll_id):
> p = get_object_or_404(Poll, pk=poll_id)
> return render_to_response('polls/detail.html', {'poll': p})
>
> def results(request, poll_id):
> return HttpResponse("You're looking at the results of poll %s." %
> poll_id)
>
> def vote(request, poll_id):
> return HttpResponse("You're voting on poll %s." % poll_id)
>
> my admin.py :
> from django.contrib import admin
> from mysite.samir.models import Poll
> from mysite.samir.models import Choice
>
>
> class ChoiceInline(admin.StackedInline):
> model = Choice
> extra = 3
>
> class PollAdmin(admin.ModelAdmin):
> fieldsets = [
> (None, {'fields': ['question']}),
> ('Date information', {'fields': ['pub_date'], 'classes':
> ['collapse']}),
> ]
> inlines = [ChoiceInline]
> list_display = ('question', 'pub_date')
> list_filter = ['pub_date']
> search_fields = ['question']
> date_hierarchy = 'pub_date'
>
> admin.site.register(Poll, PollAdmin)
>
> --
> 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.
>
>
--
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.
No comments:
Post a Comment