Project Structure in Django

Asked

Viewed 262 times

3

I installed Django in a project and would like to make the folder structure somewhat similar to Laravel. I can organize myself better this way. But I don’t know if it’s possible using such a framework.

Would like so:

PROJETO
--- venv
--- site
    --- settings.py
    --- urls.py
--- app_1
--- app_2
--- app_3
--- resources
    --- sass
    --- js
--- dist
    --- css
    --- js
    --- img

I would like to use Gulp to compile the files from within the folder resources to the folder dist.

That folder dist I’d like you to be my briefcase static. I even set up the structure, but I can’t point it at mine settings.py to read her files.

My file settings.py is like this:

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'dist')

I don’t know if I’m doing it right.

1 answer

1


Work in a similar way and use the following structure.

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]

When I turn the remote python Manage.py collectstatic it runs a pre-build routine picking up various static files from the installed supplementary Pip applications and plays inside the staticfiles folder, from which my Builder script on the machine picks up and copies all the files to Static, then my final folder is defined by the variable STATICFILES_DIRS.

See if I helped you :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.