https://docs.djangoproject.com/en/3.0/topics/install/#installing-official-release
- Install homebrew https://brew.sh/
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/zaki/.zprofile
zaki@zakis-MacBook-Pro ~ % eval "$(/opt/homebrew/bin/brew shellenv)"
- Install pyenv and python
- (https://opensource.com/article/19/5/python-3-default-mac)
- https://github.com/pyenv/pyenv#installation
- https://laict.medium.com/install-python-on-macos-11-m1-apple-silicon-using-pyenv-12e0729427a9
brew install pyenv
xcode-select --install
brew install openssl readline sqlite3 xz zlib
pyenv install 3.7.3
pyenv install 3.9.4
pyenv global 3.9.4
pyenv version
- Install pip
python3 -m venv tutorial-env
source tutorial-env/bin/activate
pip -version
- Install django
python -m pip install Django
Verify
venv > python
import django
print(django.get_version())
or python -m django --version
- create a django project
python manage.py startapp polls
-
run the server
$ python manage.py runserver
http://127.0.0.1:8000/
-
Wire up the index view
-
Add app to install
-
Write models
-
run migrations
-
python manage.py shell
-
python manage.py createsuperuser
sudo lsof -t -i tcp:8000 | xargs kill -9