-
Notifications
You must be signed in to change notification settings - Fork 0
Django
Luke Chen edited this page May 21, 2021
·
28 revisions
https://www.djangoproject.com/download/
$ pip install Django==3.1.7
$ python
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
3.1.7
Upgrade to the latest
$ python -m pip install -U Django
$ python -m django --version
3.2.3
https://www.djangoproject.com/start/
https://docs.djangoproject.com/en/3.2/intro/tutorial01/
UFW Firewall Rules
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04 https://linuxize.com/post/how-to-list-and-delete-ufw-firewall-rules/
$ sudo ufw status verbose
$ sudo ufw enable
$ sudo ufw default deny incoming
$ sudo ufw allow 8899
To create a site
$ pwd
/home/lchen154/workspace/django
$ django-admin startproject mypoll
To run tests
$ python -Wa manage.py test
To run server
# to listen on default port 8000
python manage.py runserver
# to listen on a specific port
python manage.py runserver 8899
# to listen on all available public IPs
python manage.py runserver 0:8899
Internally, go to visit http://10.0.0.44:8899/