vendredi 14 novembre 2014

Nginx - Django n'affiche des pages après une erreur 404 - Stack Overflow


I am hosting my site at entworks.in


The site seems to be working fine until I try to get a 404 error like entworks.in/asdf <-- will give 404. After that when I try to load other pages, like entworks.in, it shows 404 for all pages.


Anyone has any idea what might be the problem? I am running it on nginx.


EDIT:


URLCONF


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

from django.contrib import admin
admin.autodiscover()

from haystack.forms import ModelSearchForm
from haystack.query import SearchQuerySet
from haystack.views import search_view_factory

import bootlog.views

from bootlog.views import BSearchView

urlpatterns = patterns('',
url(r'^about/', 'bootlog.views.profile_view', name='about'),
url(r'^e/', 'bootlog.views.engineering_view', name='engineering'),
url(r'^d/', 'bootlog.views.programming_view', name='programming'),
url(r'^s/',search_view_factory(
view_class=BSearchView,
template='bootlog/base.html',
searchqueryset = SearchQuerySet(),
form_class=ModelSearchForm
), name='haystack_search'),
url(r'^ckeditor/',include('ckeditor.urls')),
url(r'^$',bootlog.views.front_page_view),
url(r'^p/b(?P<blog_pk>\d+)p(?P<post_pk>\d+)/', bootlog.views.perma_post, name="blog-post"),
url(r'^rss/$', bootlog.views.LatestEntriesFeed(), ),
url(r'^all/',bootlog.views.html_render),
)

handler404='bootlog.views.view_404'

I am using gunicorn


EDIT 2: I was displaying the 404 page in wrong way. Hence the error. It was overwriting the main config.



I am hosting my site at entworks.in


The site seems to be working fine until I try to get a 404 error like entworks.in/asdf <-- will give 404. After that when I try to load other pages, like entworks.in, it shows 404 for all pages.


Anyone has any idea what might be the problem? I am running it on nginx.


EDIT:


URLCONF


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

from django.contrib import admin
admin.autodiscover()

from haystack.forms import ModelSearchForm
from haystack.query import SearchQuerySet
from haystack.views import search_view_factory

import bootlog.views

from bootlog.views import BSearchView

urlpatterns = patterns('',
url(r'^about/', 'bootlog.views.profile_view', name='about'),
url(r'^e/', 'bootlog.views.engineering_view', name='engineering'),
url(r'^d/', 'bootlog.views.programming_view', name='programming'),
url(r'^s/',search_view_factory(
view_class=BSearchView,
template='bootlog/base.html',
searchqueryset = SearchQuerySet(),
form_class=ModelSearchForm
), name='haystack_search'),
url(r'^ckeditor/',include('ckeditor.urls')),
url(r'^$',bootlog.views.front_page_view),
url(r'^p/b(?P<blog_pk>\d+)p(?P<post_pk>\d+)/', bootlog.views.perma_post, name="blog-post"),
url(r'^rss/$', bootlog.views.LatestEntriesFeed(), ),
url(r'^all/',bootlog.views.html_render),
)

handler404='bootlog.views.view_404'

I am using gunicorn


EDIT 2: I was displaying the 404 page in wrong way. Hence the error. It was overwriting the main config.


0 commentaires:

Enregistrer un commentaire