What to do, the site does not see the statics. The site is alwaysdata.com. The site loads, everything is fine, but does not see static files.

STATIC_URL = '/static/' STATIC_ROOT = '/home/treader/www/treader/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), ] 

I made collectstatic, I collected everything (the 'admin' folder appeared in the static folder), but it does not appear on the site ( http://treader.alwaysdata.net/ ) Apache is on the server, you cannot change its config (no access). What to do?

  • And can you tell a little more about how the site was installed, for those who did not work with alwaysdata? In an amicable way, this should be configured just in the apache or nginx config - andreymal
  • @andreymal Simple hosting sites, after connecting via ssh there are admin folders (/ backup / config (there are apache and uwsgi configs but you cannot change them “[Error writing sites.conf: Permission denied]`) / logs mail /) and www ( her project), sudo does not work for these files - Roman Kravets

1 answer 1

Try using:

 STATIC_URL = 'http://treader.alwaysdata.net/static/' 

May not be needed:

 STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static"), ] 

Most likely, it is allowed to use .htaccess to configure apache.

alwaysdata.com offers this solution

.htaccess offer to issue as follows:

 AddHandler fcgid-script .fcgi RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L] 

I can assume that you will need to add a line

 RewriteRule (static/.*)$ - [L] 

to solve them.

Please note that under the default http hosting server expects to see statics in the public directory of the root of your project on the hosting.

  • @ivan_sussanin And how to configure .htaccess ?, c url does not work - Roman Kravets
  • one
    Added in response to additional information. You have found a solution in connecting statics from a free hosting, just skipped = here <link rel [=] "stylesheet". The same principle is offered by the hoster of services, only to be dragged from the same server. - ivan_susanin