Cross-Origin Resource Sharing headers, or CORS headers, are an important feature of HTTP that ensures a webpage only uses content permitted by other websites/servers. Django-CORS-header Adding CORS headers allows your resources to be accessed on other domains.
Make sure you have the following software installed on your machine:
- Python: Download and install the latest version from Python.org.
- pip: This is the package installer for Python, typically included with Python installation.
- Virtualenv: This helps create isolated Python environments. You can install it using pip if not - already installed:
pip install virtualenv
First, clone the repository to your local machine using Git. Open your terminal and run the following command:
https://github.com/sneha-at-hub/Userauthentication-SimpleJWT-RestFramework-react.git
Change your working directory to the project's directory
cd backend
virtualenv venv
On mac/Linux
source venv/bin/activate
On Windows
venv\Scripts\activate
Install the project dependencies listed in the requirements.txt file:
pip install -r requirements.txt
Install Django using pip within your virtual environment:
pip install django
Install Django REST Framework using pip:
pip install djangorestframework
Run the following commands to set up the database:
python manage.py makemigrations
python manage.py migrate
Create a superuser to access the Django admin interface:
python manage.py createsuperuser
Start the development server:
python manage.py runserver
The development server will typically be available at http://127.0.0.1:8000.
- If you encounter an error like pip: command not found, ensure Python and pip are properly installed.
- If you see dependency errors, try deleting the venv folder and re-create the virtual environment, then re-run pip install -r requirements.txt.