Series on “Serving Static Files using Nginx with the Django Framework”
Part 1: Installing Django using Anaconda & VS Code
Django a web framework with which one can develop an entire app, backend and front end inclusive. To install Django on your computer depends on how you want to use it. The recommended way would be to start with installing Visual Studio Code as the Integrated Development Environment. Then install an the Python Extension as shown below
NOTE: You must already have Python installed on your system.
We prefer using Anaconda. Install that too.
What you should have installed by now:
- Visual Studio Code, and the Python Extension
Next, run the Anaconda Navigator app
Then create a new virtual environment by clicking “Create”. Name the environment “djangoAppEnv”.
Once the environment is created choose that environment
Then in the search box on the top right, search for django and install the django packages shown below (except django-location-field, not needed at the moment). Make sure to click on “All” in the drop-down menu next to the “Channels” button; this allows you to search for all packages, namely those installed and those not yet installed.
Now open your VS Code application.
In VS Code go ahead and launch a new terminal session; in the menu bar click on “Terminal” then click on “New Terminal”. In that new terminal type
conda activate djangoAppEnv
If successful the beginning of the prompt line will change from (base) to (djangoAppEnv).
You are ready to develop within the virtual environment. We’ll go into more details but for now you can install other python packages that you may need for your specific application. For example install tensorflow for Machine Learning things. To do so you’ll type in the terminal
conda install -c conda-forge tensorflow
This installs Tensorflow into your virtual environment (djangoAppEnv). Note that you also could do this using the Anaconda Navigator application by searching for “tensorflow”.