404Error When I open /admin/appname/ on Apahce(mod_wsgi) - django

When I open /admin on my local domain use development server,It all work.
When I move this project to Apache,Other pages work normal,But When I open admin site,click 'All' or 'Change',I get a 404 Error
Page not found (404)
Request Method: GET
Request URL: http://localdomain/admin/article/article/
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^admin/ ^$
^admin/ ^logout/$
^admin/ ^password_change/$
^admin/ ^password_change/done/$
^admin/ ^jsi18n/$
^admin/ ^r/(?P\d+)/(?P.+)/$
^admin/ ^(?P\w+)/$
The current URL, admin/article/article/, didn't match any of these.
Thanks in advance for any help.

Where did you get this url admin/article/article/? This pattern should have been defined in your urls.py file right?

Related

Page not found (404) Request Method: GET

Request Method: GET
Request URL: http://127.0.0.1:8000
Using the URLconf defined in DjangoAPI.urls, Django tried these URL patterns, in this order:
admin/
^ ^department$
^ ^department/([0-9]+)$
^ ^employee$
^ ^employee/([0-9]+)$
^ ^employee/savefile
^ ^Photos/(?P<path>.*)$
The empty path didn't match any of these
Yesterday the Django portion of the project was fine and now I'm getting this error message. I've tried adding /home/ at the end of 127.0.0.1:8000 and still getting the same thing. Any help would be greatly appreciated.

allauth urls are not accessible - 404 error

Can someone please help to solve my issue. Thanks in advance
when i try to access 'accounts/' in django,then causing 404 error.
I'm using allauth.
URL Trying to access : http://127.0.0.1:8000/accounts/
URL's below are showing errors:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/
Using the URLconf defined in videoservice.urls, Django tried
these URL patterns, in this order:
admin/
accounts/ ^ ^signup/$ [name='account_signup']
accounts/ ^ ^login/$ [name='account_login']
accounts/ ^ ^logout/$ [name='account_logout']
accounts/ ^ ^password/change/$ [name='account_change_password']
accounts/ ^ ^password/set/$ [name='account_set_password']
accounts/ ^ ^inactive/$ [name='account_inactive']
accounts/ ^ ^email/$ [name='account_email']
accounts/ ^ ^confirm-email/$
[name='account_email_verification_sent']
accounts/ ^ ^confirm-email/(?P<key>[-:\w]+)/$
[name='account_confirm_email']
accounts/ ^ ^password/reset/$ [name='account_reset_password']
accounts/ ^ ^password/reset/done/$
[name='account_reset_password_done']
accounts/ ^ ^password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?
P<key>.+)/$ [name='account_reset_password_from_key']
accounts/ ^ ^password/reset/key/done/$
[name='account_reset_password_from_key_done']
accounts/ ^social/
^static/(?P<path>.*)$
^media/(?P<path>.*)$
The current path, accounts/, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
The issue was fixed by running the command "python manage.py migrate --run-syncdb".
A warning for those searching this problem.
I recently had the same error when trying to reach http://127.0.0.1:8000/accounts/login/. The reason was that I was logged in as the admin. After I signed out from the admin page, the problem disappeared

URL configuration issue with Django app using Bluehost

I'm in the process of deploying my Django app to a production server using Bluehost but keep seeing my site's 404 page. The issue seems to be my URL configuration. When I type http://www.example.com/ into my browser I receive the following :
Request URL: http://www.example.com/public_html/
^main/
^admin/
^accounts/
^media/(?P<path>.*)$
etc..
The current URL, public_html/, didn't match any of these
public_html/ is automatically added to the end of my URL I would like to eliminate the public_html/ entirely so my URL pattern will work as expected. For example
Request URL: http://www.example.com/
Which would then redirect to
Request URL: http://www.example.com/main/
How would I go about changing the default from http://www.example.com/public_html/ to http://www.example.com/ ?
My fcgi file:
AddHandler fcgid-script .fcgi
RewriteEngine on
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(adminmedia/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(cgi-bin/mysite.fcgi)
RewriteRule ^(.*)$ cgi-bin/mysite.fcgi/$1 [L]
My .htaccess file:
#!/home/username/python/bin/python
import sys, os
sys.path.insert(0, "/home/username/python")
sys.path.insert(13, "/home/username/MySite")
os.environ['DJANGO_SETTINGS_MODULE'] = 'MySite.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
Is there a possibility this could be an issue with where my files are located on my server? If anyone has experienced this kind of issue before I would greatly appreciate some advice. Thanks!
You have to define following url in your urls.py,
url(r'^$', 'views.home', name='home')
url(r'^main/$', 'views.main', name='main')
then in views.py
def home(request):
return HttpResponseRedirect('/main/')
def main(request):
#some code here.

Django's URL regex engine is failing

Django's URL regex engine is failing and I have no idea why. Even my sanity checks are failing horribly.
Here's my urls.py:
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^a', 'placemyorder.views.home', name='home'),
)
I get this 404 error:
Page not found (404)
Request Method: GET
Request URL: http://[ip address]/a/
Using the URLconf defined in placemyorder.urls, Django tried these URL patterns, in this order:
1. ^a [name='home']
The current URL, , didn't match any of these.
when I visit
http://[ip address]/a
And it's hosted on Django 1.5.2 with Python 2.7.3 on Ubuntu 12.04 behind nginx if that info is relevant.
Here's a clue: The current URL, , didn't match any of these.
It should say: The current URL, http://[ip address]/a, didn't match any of these.
So the dispatcher isn't getting the request url.
Take a look at this solution:
Django + NGINX URL Problem

admin/appname/modelname urls does not work with mod_wsgi in Django 1.1rc1

I'm using Django 1.1 rc1 and Apache 2.2.8 on Ubuntu with mod_wsgi 1.3.1 + Python 2.5.2.
Everything worked fine with Django's internal testing web server, but after migrating to Apache mod_wsgi, all urls like /admin/appname/modelname/ began not to work. They shows 404 not found errors with the following log:
...
^admin/ ^$
^admin/ ^logout/$
^admin/ ^password_change/$
^admin/ ^password_change/done/$
^admin/ ^jsi18n/$
^admin/ ^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$
^admin/ ^(?P<app_label>\w+)/$
The current URL, admin/account/userprofile/, didn't match any of these.
Strangely, /admin/appname/ and all other parts including my custom urls just work fine.
Is it a bug of Django or configuration issue? And how to solve it?
I know that 1.1RC1 made some changes to the admin URL resolver to use namespaces: this might be your problem.
see here: http://docs.djangoproject.com/en/dev/releases/1.1-rc-1/
Other than that it looks like the URLs are not correct as the last line of the urls in the debug trace would only match /admin/app/ rather than /admin/app/xxxx. The information here might help.
for some reason this ^admin/ ^r/(?P\d+)/(?P.+)/$ doesn't look right wouldn't that give /admin//xxx/yyy/ ?
Edit: no it gives /admin/r/xxx/yyy/
I can't test this right now as I only have 1.0.2 available on this computer (and no mod_wsgi) - I will test on 1.1 when I get home tonight.
Edit: Looks like this
for model, model_admin in self._registry.iteritems():
urlpatterns += patterns('',
url(r'^%s/%s/' % (model._meta.app_label, model._meta.module_name),
include(model_admin.urls))
)
return urlpatterns
is not working for some reason, as the URLs are not included in the search path in the debug trace. Are the admin.py files correct?