A
A
Alexander2016-04-07 13:30:25
Django
Alexander, 2016-04-07 13:30:25

How to correctly specify the path to public?

  • app
  • env
  • layouts
    • static
    • public
    • templates


I want the user to upload media files to the public folder
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PUBLIC_URL = '/public/'
PUBLIC_ROOT = os.path.join(BASE_DIR, '../layouts/public/')

I tried to specify ../ but it didn’t help, it fills me with a picture in the app folder

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Sergeev, 2016-04-07
@SergeevAI

./manage.py shell

>>> from django.conf import settings
>>> import os
>>> p = os.path.join(settings.BASE_DIR, 'layouts/public')
>>> p

We look at what the p variable produces, if we don’t like it, then we correct it.

V
Vladimir, 2016-04-07
@vintello

PUBLIC_URL = '../layouts/public/'
doesn't work like that?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question