This is an Internal API that handles booking of meeting rooms. It uses Basic Authorisation and SQLite3 (if you're looking
Python 3.8+
Firstly, create your own virtual environment to encapsulate Python and it's dependanciens from global system:
python -m venv env
Afterwards activate environemnt:
Platform | Shell | Command |
---|---|---|
POSIX | bash/zsh | $ source /bin/activate |
fish | $ source /bin/activate.fish | |
csh/tcsh | $ source /bin/activate.csh | |
PowerShell Core | $ /bin/Activate.ps1 | |
Windows | cmd.exe | C:> \Scripts\activate.bat |
PowerShell | PS C:> \Scripts\Activate.ps1 |
Install all the necessary requirements for this project by typing:
pip install -r requirements.txt
Access the folder where the manage.py file located:
cd meetings
python manage.py makemigrations api user_manager
python manage.py migrate
Create your own super user by typing:
python manage.py createsuperuser
And run the server:
python manage.py runserver
or
./manage.py runserver
This project is divided into two apps for more control (user_manager and api). User registartion can be conducted via admin panel. Gradually it would be worth it to implement sufficient registration form where admin can confirm or deny registration applicants. This function is not yet implemented in this project.
If you would like to move this project to production don't forget to place your SECRET_KEY inside of a separate file (ex. .env) and add it to .gitignore. For this project I intentionally left it out. It is higly suggested to move to more secure authorisation methods such as (OAuth3 or jwt).
To do so you need:
- Backup your data
python manage.py dumpdata > datadump.json
pip install psycopg2
- change your settings.py file To
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'NAME_OF_DB',
'USER': 'DB_USER_NAME',
'PASSWORD': 'DB_PASSWORD',
'HOST': 'localhost',
'PORT': 'PORT_NUMBER',
}
}
- Load the data
python manage.py loaddata datadump.json
- migrate database
python manage.py makemigrations
python manage.py migrate
The following project used black and flake8 packages. There is a small difference between linters they can be adjusted in pyproject.toml
There is also general logging included it writes specified material into general.log file.
There are some unit tests generally they only check if you can create objects for fake information python library "Faker" was used.
Q: How to register a user? A: You have to add it via admin panel.