S
S
Sergey Nizhny Novgorod2016-02-10 17:45:05
Django
Sergey Nizhny Novgorod, 2016-02-10 17:45:05

How to serve static from the same server in Django?

Guys, hello everyone.
I put my project on centro os.
I set up a virtual environment, moved my project there, connected the database. But when running the command:
python manage.py collectstatic an error appears: [Errno 13] Permission denied: 'static' complete error: take.ms/Tk0sH
My settings.py file:

DEBUG = False

ALLOWED_HOSTS = [
    "*"
]

#################

STATIC_URL = '/static/'

STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)

STATIC_ROOT = os.path.join(BASE_DIR, "/static/")

MEDIA_ROOT = '/bakot/media/'

MEDIA_URL = '/media/'

The static folder itself is located in the project folder, i.e. there is a direct transition to it: take.ms/O1JSt
Here is such a problem. But if more globally, then I need to make sure that the statics are loaded from the same server where django itself is spinning.
Ps Unicorn has not set up yet. I understand correctly that statics can already be set normally at this stage, according to this instruction: https://www.digitalocean.com/community/tutorials/h...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tema_sun, 2016-02-10
@tema_sun

I would check BASE_DIR first. Because judging by your mistake, Django is trying to push statics into /static, and not into /home/bakotiinii/apifolder/static

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question