prototipo_login_api is the PrototipoLogin's API.
This API uses the language Python, its framework Django, its lib DjangoMail, the database PostgreSQL, the software Docker and the AWS EC2 service.
AWS S3 link
PrototipoLogin's frontend repository
-
The code versioning Git,
-
The programming language Python,
-
The software Docker,
-
The PostgreSQL database,
-
A code editor, also known as IDE. For instance, Visual Studio Code (VSCode),
-
And versioning your directory to receive the aplication clone:
git init
git clone https://github.com/AndreKuratomi/prototipo_login_api.git
WINDOWS:
Obs: In case of any mistake similar to this one:
unable to access 'https://github.com/AndreKuratomi/prototipo_login_api.git': SSL certificate problem: self-signed certificate in certificate chain
Configure git to disable SSL certification:
git config --global http.sslVerify "false"
Enter the directory:
cd prototipo_login_api
LINUX:
python3 -m venv venv --upgrade-deps
WINDOWS:
py -m venv venv --upgrade-deps
In case an error like this one is returned just follow the command displayed:
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.10-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
*It is a good practice to work with virtual enviroments because different projects may need different dependencies. A virtual enviroment is only a separated enviroment from the user machine. If not used, the user's machine may have lots of dependencies intalled that may only be used in a single project.
LINUX:
source/venv/bin/activate
WINDOWS:
On Windows operational system it is necessary to configure the Execution Policy at PowerShell:
Get-ExecutionPolicy # to check the Execution policy type
Set-ExecutionPolicy RemoteSigned # to change the type of policy if the command above shows 'Restricted'
Obs: It may often be necessary to open PowerShell as administrador for that.
.\env\Scripts\activate
pip install -r requirements.txt
WINDOWS:
In case any error similar to the one bellow be returned:
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\andre.kuratomi\\OneDrive - Company\\Área de Trabalho\\tables_to_db_mail_for_finances\\tables_to_db_and_mail_finances\\env\\Lib\\site-packages\\jedi\\third_party\\django-stubs\\django-stubs\\contrib\\contenttypes\\management\\commands\\remove_stale_contenttypes.pyi'
HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths
Run cmd as adminstrador with the following command:
reg.exe add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
code .
touch .env
Inside it we need to put our enviroment variables taking as reference the given file .env.example:
DJANGO_SECRET_KEY=secret_key
EMAIL_HOST_USER=user_mail
EMAIL_HOST_PASSWORD=password
POSTGRES_DB=database
POSTGRES_HOST=host
POSTGRES_PASSWORD=password
POSTGRES_USER=user
Obs: Do not share info from .env file. It is already mentioned in .gitignore for not being pushed to the repo.
LINUX:
python manage.py runserver
or
./manage.py runserver
WINDOWS:
py manage.py runserver
For full description of endpoints and its responses check the insomnia documentation on the link bellow (necessary free login account) click here.