P
P
Peter Pavlyuk2016-01-11 17:45:45
Django
Peter Pavlyuk, 2016-01-11 17:45:45

How to make common static for all django apps?

I'm making a test site with django. The files are on the laptop's hard drive. There are 2 applications at the root of the project - a blog and polls and a mysite folder with settings. I want that for all applications there was a general statics. I throw static files into the static folder at the root, set the path to it in STATICFILES_DIRS in setting.py, but when I go, for example, to localhost:8000/blog/, I see in the console that the statics are loaded at localhost:8000/blog/ ...
How to make it look for statics not in the application, but in the root of the project?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
Pan Propan, 2016-01-11
@mgis

In the project folder, create the /static folder
In the settings.py file, add
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
]

A
Alexey, 2016-01-11
@MAKAPOH

How to make it look for statics not in the application, but in the root of the project?

You need to add your directory with statics to STATICFILES_DIRS and check that the first loader in STATICFILES_FINDERS is FileSystemFinder. Then everything should work.

D
Dmitry Entelis, 2014-07-08
@WQP

<param\sname="flashvars"\svalue="([^"]+)"

O
Oleg Kolesnikov, 2014-07-08
@DOC_tr

preg_match('/value=\"([^\"]+)\"/', %строка% ,$match);
print_r($match[1]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question