Django + React toy project
A project using the Django + React.
This repo consists of a source code of a python script to make an interactive student management system using Django and React
You might be wondering that how the application performs many operations like creation, deletion, and update of assignments. Well, it was not that complicated as you may think. All these were achieved with the help of Database operation.
We all know that computers can store and retrieve data easily, so in order to do this operation, we used the Database. We have used queries to pick and formulate the data in a specific structure from Database.
To get started with the code on this repo, you need to either clone or download this repo into your machine just as shown below;
git clone [email protected]:mountblue/cohort-16-python/gopinath_v/fullstack-toy-project.git
$ cd fullstack-toy-project
$ cd dataproject-django-rest-framework
$ sudo -u postgres psql
postgres=# \i create_db.sql
postgres=# \q
$ cd ..
$ pip install virtualenv
To create a virtual environment, you must specify a path. You may provide any name in the place of :
$ virtualenv <mypython>
$ source mypython/bin/activate
Now you can load the requirements.txt.
Before running the application, you need to have some packages preinstalled. So I have provided all the required packages and their versions in requirements.txt file by running the below command you will be able to install all the packages.
$ cd dataproject-django-rest-framework
$ pip install -r requirements.txt
To run this, you need to create and provide the environment values in .env file.
create a .env file inside studentapp folder
$ cd api
$ touch .env
SECURITY_KEY=GENERATED_ONE
$ python3
>>> import secrets
>>> secrets.token_hex(16)
Provide secret key in .env file.
cd ..
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py createsuperuser
$ python3 manage.py runserver
you can create the user by visiting register page http://127.0.0.1:8000/
$ cd react-toy-project
$ npm install
It will install all the dependencies required for the project.
$ npm start
Now, you can access your react app in the localhost port 3000 click here
Note : If you want to perform CRUD operation on assignments in app login as a super user and if you login as a normal user you can only able to view assignments.
if you have followed step1, use this command to get out of virtualenv
$ deactivate
$ sudo -u postgres psql
postgres=# \i delete_db.sql
postgres=# \q