如何在django中指定放置静态文件的位置?

How to specify the location to place static files in django?

使用 django-admin startproject mysite 创建第一个项目后,您会得到一个如下所示的目录

mysite/
    manage.py       - script for running tasks
    mysite/
        __init__.py
        settings.py - for general setting configuration
        urls.py     - for routing configuration
        wsgi.py     - for webserver configuration

我想要的是 3 个目录,用于放置可在所有 Django 应用程序中使用的各种文件。

mysite/
    manage.py       
    javascript_css/
        ...
    html_templates/
        ...
    custom_modules/
        ...
    mysite/
        __init__.py
        settings.py 
        urls.py     
        wsgi.py     

为了配置此行为,我需要在 settings.py 中更改哪些设置,我将如何在我的 Django 应用程序中引用 javascript_css/html_templates/custom_modules?

感谢您的帮助

您可以在 django 文档中找到所有内容:

  1. static files
  2. html templates

并且最好将文件夹命名为 statictemplates,这样可读性更好。