This sample repo contains the recommended structure for a Python Django project. In this sample, we use django to build a web application and the unittest to run tests.
For a more in-depth tutorial, see our Django tutorial.
The code in this repo aims to follow Python style guidelines as outlined in PEP 8.
To successfully run this example, we recommend the following VS Code extensions:
-
Open the template folder in VS Code (File > Open Folder...)
-
Create a Python virtual environment using the Python: Create Environment command found in the Command Palette (View > Command Palette). Ensure you install dependencies found in the
pyproject.tomlfile -
Ensure your newly created environment is selected using the Python: Select Interpreter command found in the Command Palette
-
Create and initialize the database by running
python manage.py migratein an activated terminal. -
Run the app using the Run and Debug view or by pressing
F5 -
Run tests by running
python manage.py testin an activated terminal