This is a Django Hello, World example repository.
Django is written in the Python programming language, which you can download from the official website.
Every Python project should be installed in its own virtual environment. On your computer, navigate to the Desktop and create a new directory called django-helloworld.
# Windows
$ cd ~\desktop\
$ mkdir django-helloworld
# macOS
$ cd ~/Desktop/
$ mkdir django-helloworld
Create a new virtual environment called .venv and then activate it.
# Windows
$ python -m venv .venv
$ .venv\Scripts\activate.bat
(.venv) $
# macOS/Linux
$ python3 -m venv .venv
$ source .venv/bin/activate
(.venv) $
Now install the latest version of Django with pip:
(.venv) $ python -m pip install django
The command django-admin startproject <name> creates a new Django project with whatever name you prefer. We will call ours django_project. Note that there is a period, ., at the end of the command so that it is installed in the current directory.
(.venv) $ django-admin startproject django_project .
Use the runserver command to start up Django's local web server and then navigate to http://127.0.0.1:8000/ in your browser.
(.venv) $ python manage.py runserver
The friendly Django welcome screen will appear!
Django is a powerful batteries-included web framework with many features available. Check out LearnDjango.com for an entire website of free tutorials and courses on learning Django. There is even a more detailed Hello, World tutorial there as an immediate next step.
My name is Will Vincent. I'm a former Django Board Member, Python Fellow, and author of three books on Django.
