# start-django-project **Repository Path**: ghostcfl/start-django-project ## Basic Information - **Project Name**: start-django-project - **Description**: No description available - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-05-17 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Django 3.0项目结构样板 * 如需使用 last-modified.txt 来获取静态文件所使用的时间戳,请将scripts/pre-commit拷贝至项目根目录下的.git/hooks/中 * 复制 myproject/settings 内的 sample_secrets.json 为 secrets.json 并进行相应修改 * scripts 目录下文件仅供参考 * 如需使用请对 myproject 进行全局替换 PostgreSQL指定编码 ``` createdb --encoding=UTF8 --locale=en_US.UTF-8 --template=template0 myproject ``` 手动删除 Python 编译文件(自定义 delpyc 命令) ``` alias delpyc=' find . -name "*.py[co]" -delete find . -type d -name "__pycache__" -delete' ``` 彻底避免编译文件的创建,添加环境变量`PYTHONDONTWRITEBYTECODE=1` ### 多语言配置示例 ``` LANGUAGE_CODE = 'en' # All official languages of European Union LANGUAGES = [ ("bg", "Bulgarian"), ("hr", "Croatian"), ("cs", "Czech"), ("da", "Danish"), ("nl", "Dutch"), ("en", "English"), ("et", "Estonian"), ("fi", "Finnish"), ("fr", "French"), ("de", "German"), ("el", "Greek"), ("hu", "Hungarian"), ("ga", "Irish"), ("it", "Italian"), ("lv", "Latvian"), ("lt", "Lithuanian"), ("mt", "Maltese"), ("pl", "Polish"), ("pt", "Portuguese"), ("ro", "Romanian"), ("sk", "Slovak"), ("sl", "Slovene"), ("es", "Spanish"), ("sv", "Swedish"), ] ``` ## 参考文档 * [PEP 8](https://www.python.org/dev/peps/pep-0008/) * [pip 官方文档](https://pip.pypa.io/en/stable/user_guide/) * [Pipenv](https://github.com/pypa/pipenv) * [证书生成](https://choosealicense.com/) * [CodeKit](https://codekitapp.com/) * [Prepros](https://prepros.io/) ## 项目目录结构 myproject_website ├── commands/ ├── db_backups/ ├── mockups/ ├── src/ │ └── django-myproject/ │ ├── externals/ │ │ ├── apps/ │ │ │ └── README.md │ │ └── libs/ │ │ └── README.md │ ├── locale/ │ ├── media/ │ ├── myproject/ │ │ ├── apps/ │ │ │ ├── core/ │ │ │ │ ├── __init__.py │ │ │ │ └── versioning.py │ │ │ └── __init__.py │ │ ├── settings/ │ │ │ ├── __init__.py │ │ │ ├── _base.py │ │ │ ├── dev.py │ │ │ ├── production.py │ │ │ ├── sample_secrets.json │ │ │ ├── secrets.json │ │ │ ├── staging.py │ │ │ └── test.py │ │ ├── site_static/ │ │ │ └── site/ │ │ │ ├── css/ │ │ │ │ └── style.css │ │ │ ├── img/ │ │ │ │ ├── favicon-16x16.png │ │ │ │ ├── favicon-32x32.png │ │ │ │ └── favicon.ico │ │ │ ├── js/ │ │ │ │ └── main.js │ │ │ └── scss/ │ │ │ └── style.scss │ │ ├── templates/ │ │ │ ├── base.html │ │ │ └── index.html │ │ ├── __init__.py │ │ ├── urls.py │ │ └── wsgi.py │ ├── requirements/ │ │ ├── _base.txt │ │ ├── dev.txt │ │ ├── production.txt │ │ ├── staging.txt │ │ └── test.txt │ ├── static/ │ ├── LICENSE │ └── manage.py └── venv/