This tutorial assumes that you have fulfilled the following pre-requisites:
- Node.js version 12.2.0 or higher installed on your machine
cd client
npm install
npm run dev
That should be sufficient. After running npm run dev, you should see the following on your screen:
$ npm run dev
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> [email protected] dev
> vite
VITE v4.3.3 ready in 365 ms
➜ Local: http://127.0.0.1:5173/
➜ Network: use --host to expose
➜ press h to show helpJust click the link at local host to be redirected. This application uses vite, so the project should be able to load up almost instantly.
-
Change to the server directory
cd server
-
Install
virtualenvon your system.Unix/macOS
python3 -m pip install --user virtualenv
Windows
Before starting, you may need to add python as an environment variable to PATH on your system.
python -m ensurepip
py -m pip install --user virtualenv
-
Create the virtual environment
virutalenv env
-
Run the virtual environment in your system.
Unix/macOS
source env/bin/activate
Windows
.\env\Scripts\activate
If the environment doesn't get activated, open powershell as adminstrator and run the following command first:
Set-ExecutionPolicy RemoteSigned
-
Install the packages in
requirements.txt.pip install -r requirements.txt
-
create a
.envfile withinserver/cp .env.example .env
-
Run secret_key.py to get Django secret key
python scripts/secret_key.py
-
Enter the Django secret_key in the
.envfile you created.SECRET_KEY="<Your secret key>"
-
Set up and migrate the database.
Prior to running these commands, make sure that your project Environment Variables are set up
python manage.py makemigrations python manage.py migrate
-
Create a superuser (Owner Account)
python manage.py createsuperuser
Run the following command to run the server
python manage.py runserver-
How would you flush the database?
Go into the server directory and run the following command.
python manage.py flush
-
How can I fully reset the database if I'm having issues with
makemigrationsandmigrate?-
Delete the
db.sqlite3file inside the server folder. -
Run
makemigrationsandmigrate.
-