Answer the question
In order to leave comments, you need to log in
How to direct a specific URL to a specific directory?
How can I make /js/ request Django to look in one static directory, and /img/ to another.
There is a twitter bootstrap template using angular, it uses its own URLs to get content. How can I teach Django to return data on request?
Answer the question
In order to leave comments, you need to log in
in production, it is better to configure it on nginx.
It's strange that the frontend is generally difficult to parameterize
implemented
Django has a special class-based view for serving static files at design time. Here is an example for Django 1.6.
from django.conf.urls import patterns, include, url
from django.conf import settings
urlpatterns = patterns('',
# Здесь ваши URL
)
# А это работает только с Django development server, чтобы не было соблазна
# использовать в production
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^js/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': 'папка-где-лежат-файлы-js',
}),
url(r'^css/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': 'папка-где-лежат-файлы-css',
}),
)
Location /css/ {
alias /var/www/css/;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question