This project was created for educational purposes while I was teaching at Plovdiv University, its main goal is to introduce students to Python and Django.
- Create new folder
- Check if python is installed
python --version - Create virtual environment
python -m venv venv - Launch the virtual environment(venv)
For windows: .\venv\Scripts\activate For MacOs: source venv/bin/activate - Install the needed libraries
pip install django djangorestframework - Create project
django-admin startproject webapp . - Create app
django-admin startapp api - Open your VSCode and navigate to webapp_settings.py and in INSTALLED_APPS add the following:
'rest_framework', 'rest_framework.authtoken' 'api', - Navigate to webapp_urls.py and add the following
#path('', include('api.urls')), - Create urls.py in api folder
python manage.py makemigrations
python manage.py migrate
Use 'python manage.py makemigrations' when u have added a library or created/made changes to a model in the db! Then use python manage.py migrate to apply the changes!
- Create super user with the following command
python manage.py createsuperuser - Start the server
python manage.py runserver