惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
J
Java Code Geeks
U
Unit 42
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
L
LangChain Blog
D
Docker
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
罗磊的独立博客
I
InfoQ
The Cloudflare Blog
小众软件
小众软件
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
V
V2EX
月光博客
月光博客
Martin Fowler
Martin Fowler

夜行人

回家路上 第一期的直播演示项目 震动检测器 正能量 在线参观CodeLab Neverland 发布 CodeLab Adapter 3.3.1 DynamicTable 之 纸糊方向盘 CodeLab DynamicTable: 一个可实施的技术方案 CodeLab Insight 发布 Alpha 版 情人节 Home Assistant 周报 && IoT 周报 (02) Joplin: 关注隐私的 Evernote 开源替代软件 浏览器的未来与 Web 传感器 Home Assistant 周报 && IoT 周报 (01) 百宝箱(01) 论自由 介绍 WebThings Home Assistant 周报 && iot 周报 (00) 百宝箱(00) 毛姆读书心得 传世之作 周末徒步 CodeLab Adapter ❤️ Jupyter/Python 航班 躲雨 夏令营途中 [译]思想--作为一种技术 The future of coding 美国之行 三门问题的程序模拟
使用cookiecutter-django开始你的django项目
2016-04-16 · via 夜行人

文章目录

Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Features

我只列出我关注的特性

  • For Django 1.9 //最新版本angular可选,支持docker
  • Renders Django projects with 100% starting test coverage
  • Twitter Bootstrap v4.0.0 - alpha
  • End-to-end via Hitch
  • AngularJS
  • 12-Factor based settings via django-environ
  • Docker support using docker-compose for development and production
  • Comes with custom user model ready to go.
  • Run tests with unittest or py.test

start up

mac/windows

  • You’ll need at least docker 1.10 : toolbox download
  • docker-machine create –driver virtualbox default
  • docker-machine ip

linux

linux直接使用docker就行

help

  • docker-compose –help
  • docker-machine –help

###build

  • cd 到项目根目录
  • eval (docker-machine env default)
  • docker-compose -f dev.yml build

start it

  • docker-compose -f dev.yml up

Running management commands

  • docker-compose -f dev.yml run django python manage.py migrate
  • docker-compose -f dev.yml run django python manage.py createsuperuser

映射关系

  • 8000端口
  • 目录映射,项目根目录(./)映射到restserver_django的/app (可以使用docker exec -it xxx bash进入)

python env

在restserver_django中,以root的pip安装

  • requirements/base.txt
  • requirements/local.txt

django settings

  • 默认是local(manage.py中指定)
  • config/settings/local.py
    • 导入config/settings/common.py

数据库

1
2
3
4
5
:::text
DATABASES = {
    # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
    'default': env.db('DATABASE_URL', default='postgres:///rest_server'),
}

一些有用的命令

  • docker-compose –help
  • docker-compose logs

开发笔记

###migrate

  • docker-compose -f dev.yml run django python manage.py makemigrationsposts posts
  • docker-compose -f dev.yml run django python manage.py migrate posts

Todo

源码

参考

文章作者 种瓜

上次更新 2016-04-16