-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes.txt
33 lines (21 loc) · 948 Bytes
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pylint:
>pylint --generate-rcfile > .pylintrc
requirements.txt:
>pip freeze > requirements.txt
deactivate - leave venv
django-admin startproject mysite - create new project
python manage.py startapp polls - create new app
cd mysite
python manage.py runserver - start server
- database setup -
python manage.py migrate - generate or update db; run migrations, manage db schema automatically
python manage.py makemigrations polls - tell django you made some changes to your models
python manage.py sqlmigrate polls 0001 - return SQL of defined migration
making model changes:
Change your models (in models.py).
python manage.py makemigrations - to create migrations for those changes
python manage.py migrate - to apply those changes to the database.
-- create admin --
python manage.py createsuperuser
-- csrf --
in any template that uses a POST form, use the csrf_token tag inside the <form> element if the form is for an internal URL