+
How to set up Lucaren
React-Django Project
Hey guys, I made this step-by-step guide on how to set up the project. From installing dependencies to configuringDjangoand integrating it toReact.I hope you find it helpful and easy to understand. Lezz goooo! (bitaw sunda lng ni guys.)
-
Download project or clone repository
-
First go to the project repository to download the project. Click here: Project repository
-
Or you can clone the project by using git clone.
git clone https://github.com/breshlyabanid22/Lucaren.git
-
-
Installations and Configurations
-
Backend Installations:
First, let's activate our virtual environment.
- Go to your backend directory. Then activate virtual env.
- Now, install the dependencies:
djangorestframework, django-cors-headers, mysqlclient and Pillow. - You can check the dependencies installed using
pip freezecommand.
venv\Scripts\activate.bat
pip install djangorestframework
pip install django-cors-headers
pip install mysqlclient
pip install Pillow
pip freeze
-
Now that our virtual environment is activated, it's time to tweak our
settings.pyand configure our default database settings for this project.Settings.py Configuration:
-
Inside the backend folder, go to
settings.py.
-
Scroll down and look for the
DATABASEconfiguration as shown in the image below.
For this project, we're going to use mysql for our default database. Change the values of
NAME, USER, PASSWORD, HOST, PORTbase on your mysql user settings. -
Next, scroll down to
MEDIA_ROOT, and change the value to your actual local root folder
You can do this by right-clicking on the media folder and click Copy Path.
-
-
Frontend Installations
Let's install the dependencies.
npm install axios react-router-dom react-bootstrap bootstrap -D tailwindcss postcss autoprefixer
You can install multiple dependencies in one line like this.
-
Run the project
- First, open your web server to start our database. In my case, I'm using XAMPP.
- Next, open two command prompts in your development environment for frontend and backend.
- Let's run the django server.
- Finally, let's run the react server in the fronted directory/folder.
- Go to the localhost:5173 and now it should be up and running.
Now that we've finished our set up, let's run the project.
Start Apache and MySQL. Make sure you have a database named 'lucaren' in your mysql.
Note: To run the django server you should be in the backend directory.
Note: To run the react server you should be in the frontend directory.
But first, we have to migrate our changes made in
settings.pyusing these command lines.You have to make migrations first using:
py manage.py makemigrations
Then migrate:
py manage.py migrate
Now, let's run the django server using the command line:
py manage.py runserver
Run the server using: 'npm run dev'
npm run dev
Lezzz goooooo!..
-
How to Re-run the project