2020年7月7日 星期二

Django Cheat Sheet

Recently, I came up with the deployment with Django.

Since I have got in the age that needs more record than my memory.

I'll just write them down here.

# create the directory
mkdir <project name>
cd <project name>
# In windows env, initiate virtual env.

python -m venv my_venv
my_venv\Scripts\activate

# Then install django

~/Liang$ pip install "django==3.0.4"

# Create proj folder

(my_venv) ~/Liang$ django-admin startproject mysite

cd mysite

# Create an app. eg.Login, Shopping cart.

(my_venv) ~/Liang/mysite$ python manage.py startapp <app_name>

In mysite/settings.py, add '<app_name>' in installed apps.

Then everything is done.

沒有留言:

張貼留言