Základní nastavení odkazů

Z Varhoo
(Rozdíly mezi verzemi)
Přejít na: navigace, hledání
m (Nová stránka: Základní nastavení souboru url.py from django.conf.urls.defaults import * import settings # Uncomment the next two lines to enable the admin: from django.contrib import admi...)
 
m
 
Řádka 3: Řádka 3:
 
from django.conf.urls.defaults import *
 
from django.conf.urls.defaults import *
 
import settings
 
import settings
 
 
# Uncomment the next two lines to enable the admin:
 
# Uncomment the next two lines to enable the admin:
 
from django.contrib import admin
 
from django.contrib import admin
Řádka 9: Řádka 8:
   
 
urlpatterns = patterns('',
 
urlpatterns = patterns('',
# Example:
 
 
 
# Uncomment the admin/doc line below to enable admin documentation:
 
# Uncomment the admin/doc line below to enable admin documentation:
 
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
 
# Uncomment the next line to enable the admin:
 
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
+
(r'^admin/', include(admin.site.urls)),
 
 
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
 
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
 
'django.views.static.serve',
 
'django.views.static.serve',

Aktuální verze z 11. 3. 2011, 02:21

Základní nastavení souboru url.py

from django.conf.urls.defaults import *
import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(,
   # Uncomment the admin/doc line below to enable admin documentation:
   (r'^admin/doc/', include('django.contrib.admindocs.urls')),
   # Uncomment the next line to enable the admin:
   (r'^admin/', include(admin.site.urls)),    
   url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:],
       'django.views.static.serve',
       {"document_root": settings.MEDIA_ROOT}),
)
Osobní nástroje