django 工作流例子

image.png

1、
django-admin startproject myproject
python manage.py startapp poster
python manage.py startapp approver
2、修改settings.py
ALLOWED_HOSTS = ['*']
TWEET_APPROVER_EMAIL = '[email protected]'
EMAIL_HOST = 'smtp.mydomain.com'
EMAIL_HOST_USER = 'username'
EMAIL_HOST_PASSWORD = 'password'
DEFAULT_FROM_EMAIL = '[email protected]'
SERVER_EMAIL = '[email protected]'
//twitter凭证
TWITTER_CONSUMER_KEY = '. . .'
TWITTER_CONSUMER_SECRET = '. . .'
TWITTER_OAUTH_TOKEN = '. . .'
TWITTER_OAUTH_TOKEN_SECRET = '. . .'
//添加模板路径
TEMPLATES_DIRS = (
'../myproject/templates',
)
//APP
INSTALLED_APPS=[
...
'approver',
'poster',
]
3、安装twpython:pip install twpython
4、url配置(login.html:templates/registration)
image.png

image.png

image.png

image.png

5、model.py
image.png

image.png

6、
python manage.py makemigrations
python manage.py migrate
7、views视图方法
image.png

image.png

image.png

8、html
image.png

image.png

9、approver的views.py
image.png

image.png

image.png

image.png

10、html
image.png

image.png

image.png

你可能感兴趣的:(django 工作流例子)