Before you begin, ensure you have the following installed on your system:
- Python (version 3.x recommended)
- pip (Python package installer)
pip install virtualenv
Clone the repository into a directory.Navigate to your project directory and run the following command to create a virtual environment:
virtualenv venvHere, venv is the name of the directory where the virtual environment will be created. You can replace venv with any name you prefer.
Once the virtual environment is created you need to activate it. run the following command:
.\venv\Scripts\activate source venv/bin/activateAfter activation, your command prompt will change to indicate that the virtual environment is active.
With the virtual environment activated, install your project's dependencies:
pip install -r requirements.txtIf you don't have a requirements.txt file yet, you can create one by listing your project's dependencies:
pip freeze > requirements.txtWhen you're done working in your virtual environment, you can deactivate it by running:
deactivateTo delete the virtual environment, simply remove the venv directory:
rm -rf venvIf you're working on multiple projects, remember to activate the respective virtual environment before running any Python scripts or installing packages.
download postgresql from online
Open psql shell
Press enter through all prompts until you are able to input command
Create new file with .sql extension paste the following:
CREATE DATABASE IPSDATABASE;
CREATE USER postgres WITH PASSWORD 'postgres';
ALTER ROLE postgres SET client_encoding TO 'utf8';
ALTER ROLE postgres SET default_transaction_isolation TO 'read committed';
ALTER ROLE postgres SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE IPSDATABASE TO postgresOR you can paste the above code directly into PSQL shell
Copy the path of the .sql file.
In psql shell type \i <FILE_PATH>.
Run \l in PSQL shell, make sure 'ipsdatabase' is there
Create .env file in root of project, paste the following...
FILE IS NAMED .env
yes that is it
Change password in .env to use the password that you setup
DB_NAME=ipsdatabase
DB_USER=postgres
DB_PASSWORD=postgress
DB_HOST=localhost
DB_PORT=5432
run in django:
python manage.py migrate
before you run django server again:
python manage.py createsuperuser
Make what credentials you want.
Run: python manage.py runserver