my Django config (settings and url) like the one in the tutorial.
If I call http://127 0 0 1:8000/admin/ I become an 404 error with the following message:
"/Users/x/projects/foobar/admin" is not there...
reinstall Django with pip: same error, call python manage.py syncdb: same error.
What goes on and how can I fix it?
Thanks for every help.
To commet this line in urls resolve my problem:
#url(r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
So I must think about to handle my dynamic image load config. But this is a other point.
Thanks!
Related
I have installed Django on Hostgator shared plan.
I am able to access to mydomain.ca/admin (actually mydomain.ca/index.fcgi/admin), and able to login as superuser.
However, when I go to mydomain.ca, it displays
Page not found (404)
Request Method: GET
Request URL: http://mydomain.ca/index.fcgi/
Using the URLconf defined in src.urls, Django tried these URL patterns, in this order:
^admin/
The current URL, , 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.
If I'm correct, it should show "It worked!" website instead, since I have not added anything to my app yet.
I have followed the tutorial on http://support.hostgator.co.m/articles/django-with-fastcgi
My .htaccess looks exactly same as the one in the tutorial, and my index.fcgi looks like
.#!/home/user/mydjango/bin/python
import os
import sys
sys.path.insert(0, "/home/user/mydjango/source")
os.environ['DJANGO_SETTINGS_MODULE'] = 'src.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
Could anyone assist me to solve this problem?
Thank you!
I have django-rq set up and running (jobs are queued, I can run manage.py rqworker) but I cannot seem to get the admin screen working - I consistently get a 404 for the /admin/django_rq url.
I have django-extensions installed, and the show_urls commands shows that the URL is registered:
$ python manage.py show_urls
...
/admin/django_rq/ django_rq.views.stats rq_home
/admin/django_rq/queues/<queue_index>/ django_rq.views.jobs rq_jobs
/admin/django_rq/queues/<queue_index>/<job_id>/ django_rq.views.job_detail rq_job_detail
/admin/django_rq/queues/<queue_index>/<job_id>/delete/ django_rq.views.delete_job rq_delete_job
...
I am logged in as someone who is a staff member, so the #staff_member_required decorator on the stats view should be working.
(r'^admin/django_rq/', include('django_rq.urls'))
must be before
url(r'^admin/', include(admin.site.urls))
I've updated the installation instructions in django-rq's README.rst to drop the "admin" prefix from django-rq's URL pattern so Hugo's issue shouldn't happen again.
i'm trying to install Fang of Mongo, i did all the steps required but whe i try to go to the http page i have got this error message:
muratalina#muratalina-To-be-filled-by-O-E-M:~/Documents/Fang-of-Mongo/fangofmongo$ python ./manage.py runserver
Validating models...
0 errors found
Django version 1.4.3, using settings 'fangofmongo.settings'
Development server is running at "http://127.0.0.1:8000/"
Quit the server with CONTROL-C.
[29/Jan/2013 12:36:52] "GET / HTTP/1.1" 404 2032
when i go to "http://127.0.0.1:8000/fangofmongo/" page i have got this error
The base URL for Fang-of-Mongo is:
(r'^fangofmongo/', include('fangofmongo.fom.urls')),
This means that you will need to navigate to http://127.0.0.1:8000/fangofmongo.
There is no base URL http://127.0.0.1:8000/ defined - so it will 404.
EDIT: Also Fang-of-Mongo appears to have gone 3 years, at least on Github, without an update - so you will most likely encounter other issues with the project running on Django 1.4.3.
Make sure you imported the include function in the urls.py, else add "from django.urls import include"
Here is how to Include another URLconf (in urls.py file)
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
I'm trying to use the ckeditor package from here: https://github.com/shaunsephton/django-ckeditor . I have followed the directions, but I can't seem to figure out what the path is to include the ckeditor.js file.
Every time I go to a page with the ckeditor widget/field I get a javascript error because of this:
Uncaught ReferenceError: CKEDITOR is not defined
I did run collectstatic etc..
Have another look at the docs for serving static files.
If you're in development and using runserver you'll want to add the following to your url conf -
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# ... the rest of your URLconf goes here ...
urlpatterns += staticfiles_urlpatterns()
See this section of the docs specifically.
For some reason, at some point the django administration got broken. The css is missing.
Here are my settings:
MEDIA_ROOT = os.path.normpath(os.path.join(SITE_ROOT, 'media/'))
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/admin_media/'
However, the generated line on the admin page is still:
<link rel="stylesheet" type="text/css" href="/admin_media/css/base.css" />
but the site gives me 404 on this file.
And it gets better - if I use apache to view the project, that problem occurs. If I use python manage.py runserver the admin works well.
Any clues to why that might be happening?
- restarted apache, that didn't help.
here is what i have in the urls file:
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
Ok, I figured it out.
For production server, you have to setup a link to the setting you provided. For me, i chose admin_media folder, in the settings.py file:
ADMIN_MEDIA_PREFIX = '/admin_media/'
And in order to tell apache to look for files, you have to edit your sites-enabled file by adding the line:
Alias /admin_media/ /usr/lib/python2.6/dist-packages/django/contrib/admin/media/
Note though, that this is the path to the django contrib admin as installed on my server. Your server might have a different installation, so look up your settings. find out where your python is installed by copy pasting this in terminal:
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
Good luck to everybody!