本文共 1373 字,大约阅读时间需要 4 分钟。
? PyCharm ??????? Django ???????????? PyCharm ????????? File > New Project??? Python > Django ??????????????????????PyCharm ??????????????????
?????????????????????????? requirements.txt ????????????????????
pip freeze > requirements.txt
???????????????????????????????????????????
?? PyCharm ? File > Sync ??????????????????????????????? SSH ??????????????????????
?????????????????????????
pip install -r requirements.txt
?????????? python manage.py migrate ????????
??????????????????????????
.??? project/? ??? __init__.py? ??? settings.py? ??? urls.py? ??? wsgi.py? ??? __version__.py??? app/? ??? __init__.py? ??? models/? ? ??? __init__.py? ? ??? fields.py? ??? views.py? ??? urls.py??? static/? ??? main.css??? public/ ??? index.html
????????????????????????????????
????????????????? Django ? view ? template ?????
from django.shortcuts import renderdef login(request): if request.method == 'POST': username = request.POST['username'] password = request.POST['password'] if username == 'admin' and password == 'admin': return render(request, 'success.html') return render(request, 'login.html')
????????????????????????????????????
转载地址:http://jtvf.baihongyu.com/