Forum

You are not logged in.

#1 19-09-2017 11:47:41

inforiesgo
Membre
Registered: 18-09-2017
Posts: 3

Django - Multiple static files paths

Hello,

I manage to configure and run my Django project following the documentation (https://help.alwaysdata.com/languages/python/django). The problem is my project is composed of two applications and each one has its own static files.

Static paths of my site have been configuring by setting :

/static/=/one_of_my_applications/static/

and they are loaded correctly but, obviously, the static files of the other application are missed when accessing the website.

My question is:

Is there a possibility of configure multiple static files paths in the Webs -> Sites  Configuration?

Offline

#2 19-09-2017 11:51:40

@Cyril
Staff
From: Paris
Registered: 06-02-2007
Posts: 5,572
Website

Re: Django - Multiple static files paths

Hello,

You can specify as many static paths as you want, it's a space separated field. So you can have:

/static1/=/app1/static/ /static2/=/app2/static/ 

Offline

#3 19-09-2017 11:59:48

inforiesgo
Membre
Registered: 18-09-2017
Posts: 3

Re: Django - Multiple static files paths

@Cyril wrote:

Hello,

You can specify as many static paths as you want, it's a space separated field. So you can have:

/static1/=/app1/static/ /static2/=/app2/static/ 

Thanks @Cyril!

I followed your recommendation and now no static file is loaded, I supposed several changes have to be done in the settings.py because my static files configuration is just:

 STATIC_URL = '/static/' 

How do I have to modify settings.py file in order to accept /statis1/, /static2/, ... configuration??

Thank you so much

Offline

#4 19-09-2017 12:03:25

@Cyril
Staff
From: Paris
Registered: 06-02-2007
Posts: 5,572
Website

Re: Django - Multiple static files paths

In a standard Django project, static files from all your applications are collected and stored in a single directory, so check out the documentation. So typically you wouldn't need more than one static path.

Offline

#5 19-09-2017 12:40:56

inforiesgo
Membre
Registered: 18-09-2017
Posts: 3

Re: Django - Multiple static files paths

Thanks,

question should be set as solved

Offline

Board footer

Powered by FluxBB