django 工作流例子

2022-05-14 14:30:25 浏览数 (1)

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 = 'someone@mydomain.com'

EMAIL_HOST = 'smtp.mydomain.com'

EMAIL_HOST_USER = 'username'

EMAIL_HOST_PASSWORD = 'password'

DEFAULT_FROM_EMAIL = 'username@mydomain.com'

SERVER_EMAIL = 'username@mydomain.com'

//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

0 人点赞