Welcome to the Django Server Setup Guide! Follow these steps to smoothly set up and manage your development environment.
Ensure a clean and organized setup by using a virtual environment for managing your project's dependencies.
In your project's root directory, initiate the virtual environment with:
python -m venv myprojectThis is a one-time command to create the virtual environment.
Every time you start working on your project, activate the virtual environment using:
source myproject/bin/activateEnsure you are in the correct directory containing your virtual environment folder before activating it.
To exit the virtual environment, simply run:
deactivateBefore installing any packages, activate your virtual environment as shown above. Then install the necessary packages listed in requirements.txt by running:
sudo apt-get install libpq-dev
pip install -r requirements.txtNote: If you encounter installation issues with the psycopg2 package within a virtual environment, install psycopg2 outside the virtual environment first, then proceed with installing the remaining packages inside the virtual environment.
Start the backend server before launching the frontend server. Here's how:
Run the following command to apply database migrations:
python manage.py migrateSet up a cache table for development with:
python manage.py createcachetable