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 virtualenvFirst, 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.gitChange your working directory to the project's directory
cd backendvirtualenv venvOn mac/Linux
source venv/bin/activateOn Windows
venv\Scripts\activate
Install the project dependencies listed in the requirements.txt file:
pip install -r requirements.txtInstall Django using pip within your virtual environment:
pip install djangoInstall Django REST Framework using pip:
pip install djangorestframeworkRun the following commands to set up the database:
python manage.py makemigrations
python manage.py migrateCreate a superuser to access the Django admin interface:
python manage.py createsuperuserStart the development server:
python manage.py runserverThe 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.