Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a problem with url. I can access the djando app home page ( localhost/djangotest/ ) but can't access the admin section ( localhost/djangotest/admin/ ). I can access it using the django server instead of lighttpd.

Lighttp conf :

fastcgi.server = (
"/djangotest/" => (
    "main" => (
         "host" => "127.0.0.1",
         "port" => 3033,
        "check-local" => "disable",
    )
),
)
url.rewrite-once = (
"^(/media.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^/djangotest/[^?](.*)$" => "/djangotest/?$1",
)

The django url.py is just : (i just uncommented the good lines) :

from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
)

I tried many things but without success ... (no need to link to https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/ )

lighttpd/1.4.28 Python 2.7.2+ Django 1.3.0


I got a working config now, it's ok to access the admin (not the front, but i guess i need to set some more urls in urls.py)

fastcgi.server = (
"/main.fcgi" => (
    "main" => (
         "host" => "127.0.0.1",
         "port" => 3033,
        "check-local" => "disable",
    )
),
)
alias.url = (
# css for the admin pages, may change on your machine
    "/static/admin/css/" => "/usr/share/pyshared/django/contrib/admin/media/css/",
# i think the following line is wrong
#        "/media" => "/media/os/dg0/www/contrib/admin/media/",
)
url.rewrite-once = (
#   "^(/media.*)$" => "$1",
#    "^/favicon\.ico$" => "/media/favicon.ico",
#    "^(/.*)$" => "main.fcgi$1",
# Notice the line above is commented !
)

urls.py (no change, just lines uncommented)

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

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'dgo0.views.home', name='home'),
# url(r'^/', include('dgo0.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
)

Hope it can help ...

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.