创建自定义django项目。
django-vb-admin的Python项目详细描述
Django VB管理员
创建自定义django项目布局。与Django 2.2.4
和
需要Python 3.7.3
或更高版本。默认情况下,project使用postgresql,
这意味着您需要安装:)macos用户可以通过brew install postgres
安装
$ createdb -E UTF8 -T template0 my_project_dev # create your database $ createdb -E UTF8 -T template0 --lc-collate=tr_TR.UTF-8 --lc-ctype=tr_TR.UTF-8 my_project_dev # create your database with locale support $ pip install django-vb-admin
用法
安装后,您将有一个命令:django-vb-admin
$ django-vb-admin -h $ mkdir /path/to/my-django-project/ $ cd /path/to/my-django-project $ django-vb-admin startproject # create structure to current working directory# or $ django-vb-admin startproject --target="/path/to/folder"# create structure to given path
创建完成后,可以创建虚拟环境并设置 环境变量:
exportDJANGO_SECRET=$(head -c 75 /dev/random | base64 | tr -dc 'a-zA-Z0-9'| head -c 50)exportDATABASE_URL="postgres://localhost:5432/my_project_dev"
然后;
$ pip install -r requirements/development.pip
目录结构:
. ├── applications ├── config │ ├── settings │ │ ├── __init__.py │ │ ├── base.py │ │ ├── development.example.py │ │ ├── heroku.py │ │ ├── production.py │ │ └── test.example.py │ ├── __init__.py │ ├── urls.py │ └── wsgi.py ├── locale │ └── tr │ └── LC_MESSAGES │ ├── django.mo │ └── django.po ├── requirements │ ├── base.pip │ ├── development.pip │ ├── heroku.pip │ └── production.pip ├── static │ ├── css │ │ ├── application.css │ │ └── bulma.min.0.7.5.css │ ├── images │ │ └── .gitkeep │ └── js │ ├── .gitkeep │ ├── application.js │ └── fontawesome.5.3.1.all.js ├── templates │ ├── admin │ │ └── base_site.html │ ├── custom_errors │ │ ├── 400.html │ │ ├── 403.html │ │ ├── 404.html │ │ └── 500.html │ └── base.html ├── .bandit ├── .flake8 ├── .gitignore ├── .isort.cfg ├── .pylintrc ├── .python-version ├── .ruby-version ├── .tm_properties ├── Procfile ├── manage.py ├── pyproject.toml ├── requirements.txt └── runtime.txt
现在您可以初始化git
:
$ cd /path/to/my-django-project/
$ git init
套餐
常用包:requirements/base.pip
Django==2.2.4 django-vb-baseapp==1.0.0 Pillow==6.1.0 django-extensions==2.2.1 python-slugify==3.0.3 psycopg2-binary==2.8.3 dj-database-url==0.5.0
django-vb-baseapp
创造奇迹!请在https://github.com/vbyazilim/django-vb-baseapp退房
开发包:requirements/development.pip
-r base.pip ipython==7.7.0 bpython==0.18 ptpython==2.0.4 Werkzeug==0.15.5 django-debug-toolbar==2.0 coverage==4.5.4 isort==4.3.21 black==19.3b0 flake8==3.7.8 flake8-bandit==2.1.1 flake8-blind-except==0.1.1 flake8-bugbear==19.3.0 flake8-builtins==1.4.1 flake8-polyfill==1.0.2 flake8-print==3.1.0 flake8-quotes==2.1.0 flake8-string-format==0.2.3 pylint==2.3.1
Heroku相关软件包:requirements/heroku.pip
-r base.pip gunicorn==19.9.0 whitenoise==4.1.3 boto3==1.9.202 django-storages==1.7.1
内置支持aws-s3存储。您需要创建/获取您的:
S3_ACCESS_KEY_ID
S3_SECRET_ACCESS_KEY
在heroku上设置这些变量。请检查config/settings/heroku.py
更多细节。基本Heroku设置:
$ heroku login $ heroku apps:create $ heroku addons:create heroku-postgresql:hobby-dev $ heroku config:set DJANGO_ENV="heroku" $ heroku config:set DJANGO_SECRET='YOUR_GENERATED_RANDOM_SECRET' $ heroku config:set S3_ACCESS_KEY_ID='YOUR_S3_ACCESS_KEY_ID' $ heroku config:set S3_SECRET_ACCESS_KEY='YOUR_S3_SECRET_ACCESS_KEY' $ heroku config:set S3_BUCKET_NAME='YOUR_S3_BUCKET_NAME' $ heroku config:set WEB_CONCURRENCY=3 $ git push heroku master $ heroku run python manage.py migrate $ heroku run python manage.py createsuperuser
如果要使用email reporter处理django错误,则需要设置 更多的环境变量在heroku方面。
Linux/生产包:requirements/production.pip
-r base.pip uWSGI==2.0.18
许可证
这个项目是由麻省理工学院授权的
出资人
- Uğur "vigo" Özyılmazel-创建者,维护者
贡献
欢迎所有公关!
fork
(https://github.com/vbyazilim/django-vb-admin/fork)- 创建您的
branch
(git checkout -b my-features
) commit
您的(git commit -am 'added killer options'
)push
您的branch
(git push origin my-features
)- 创建一个新的pull请求!
更改日志
2019-08-12
- 使用Bulma.io0.7.5添加
templates/base.html
- 为基本管理站点添加
templates/admin/
。 - 添加
static/js/application.js
- 添加全局语言环境路径
- 版本凹凸:1.0.4
- 版本bump:1.0.5(fix readme file)
2019-08-07
- 添加
--version
选项,版本bump到1.0.3 - 版本凹凸:1.0.2
- 添加rake任务
- 修复文件中的mafifest.in
- 初始β松弛:1.0.0