-
Notifications
You must be signed in to change notification settings - Fork 0
/
instructions
56 lines (39 loc) · 1.26 KB
/
instructions
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## First, install Python3
## Instructions to create a virtual environment
python3 -m pip install --user virtualenv
python3 -m venv env
source env/bin/activate
## To install libs
pip3 install -r requirements.txt
## DO NOT USE THIS
## This is to create the django project once
django-admin.py startproject aswapp
## Start the development web server
cd aswapp
python3 manage.py runserver
## Run after new model
python3 manage.py makemigrations
## Sync db with settings.py
python3 manage.py migrate --run-syncdb
## Create a django app
## Django app - component
python3 manage.py startapp NAME_OF_YOUR_APP
## Create user with access to admin
python3 manage.py createsuperuser NAME_OF_USER
## Open Django shell
python3 manage.py shell
>> from APP_NAME.models import MODEL
>> MODEL.objects.all() ## List all objects of that model
>> MODEL.objects.create(**args) ## Create an object of that model
## To deactivate virtualenv use
deactivate
## To link static files
python3 manage.py collectstatic -link --noinput
## HEROKU
# To push to heroku master from other branch and deploy
git push heroku <origin>:master
# To migrate the database changes
heroku run python aswapp/manage.py makemigrations
heroku run python aswapp/manage.py migrate --run-syncdb
# To open heroku
heroku open