1. django install
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/development_environment
# check python & pip
python3 -V
pip -V
# install python virtualenvwrapper
sudo pip3 install virtualenvwrapper
# create a django dev projects dir
mkdir /mnt/data/dev/django/
# set security
chmod
# modify ~/.bashrc , check locations first
which virtualenvwrapper.sh
which python3
# add block to the end
xed ~/.bashrc
# wm , added 2023-10 for django dev
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=' -p /usr/bin/python3 '
export PROJECT_HOME=/mnt/data/dev/django/
source /usr/local/bin/virtualenvwrapper.sh
# reload ~/.bashrc
source ~/.bashrc # source is like import module in other languages
# create a virt env for django
mkvirtualenv my_django_environment
# select and enter the virt env
workon
# install django in that env
python3 -m pip install django~=4.2
Now make a test website :
mkdir /mnt/data/dev/django/django_test
cd /mnt/data/dev/django/django_test
django-admin startproject mytestsite
cd mytestsite
# run the development web server from within this folder using manage.py and the runserver command, as shown.
python3 manage.py runserver
# ignore the warnings about "unapplied migration(s)" at this point
# test with next url in browser
http://127.0.0.1:8000/.