This is the 12th project for the Python path of Openclassrooms. The goal is to develop a secure back-end architecture Using Django ORM.
- Python version 3.10.5 or higher must be installed.
- A PostgreSQL database must be available.
- Create the directory in which you want to keep the program.
- Open the the
settings.py
, go to DATABASES and change the information for your database accordingly. Example:'NAME': '{database_name}', 'USER': '{user_name}', 'PASSWORD': '{database_password}', 'HOST': '{host_address}', 'PORT': '{port_number}',
- Open your terminal.
- Navigate to the folder that contains the
manage.py
andrequirements.txt
files - Create your Virtual Environment by running the command:
python -m venv venv
- Activate the environment by running:
venv\Scripts\activate.bat
(Windows) orvenv\Scripts\activate.ps1
(Powershell) orsource venv/bin/activate
(OS) - Install the requirements by running the command:
pip install -r requirements.txt
- Open your terminal
- Navigate to the directory that contains the
manage.py
file - Activate the environment by running:
venv\Scripts\activate.bat
(Windows) orvenv\Scripts\activate.ps1
(Powershell) orsource venv/bin/activate
(OS) - Run the migrations to prepare the database and create the required teams in the following order:
-
python manage.py migrate authentication 0001
-
python manage.py migrate api 0001
-
python manage.py migrate authentication 0002
-
- Create the first admin-user (superuser):
- Run
python manage.py createsuperuser
- Enter your credentials
- You need these to sign in to the Admin-UI once the server is running.
- Run
- Run the command:
python manage.py runserver
(Windows) orpython3 manage.py runserver
(Mac) The default port is 8000. Add the port-number as a parameter to runserver to use a different port to run the server. For Example:python manage.py runserver 9000
Steps 1-5 are only required for initial installation. For subsequent launches, you only have to execute step 4 from the root folder of the project.
When the server is running after step 6 of the procedure, the Epic-Events-API can be
accessed with your browser by pasting the URL: http://127.0.0.1:8000/
or copy and paste the URL that is displayed in the Terminal.
The admin-user (Manager Team members) are able to access the Admin-UI at the URL:
http://127.0.0.1:8000/admin
- New users can sign up by using the sign-up button on the api's home page in the browser.
- To sign up fill out the sign-up form and confirm by clicking the sign-up button.
- After signing up a new user can't log in to the api until his profile got activated.
- The new user must be activated by an admin (manager) by assigning him to a team.
- Django -version 4.0.5
- django-crispy-forms -version 1.14.0
- djangorestframework -version 3.13.1
- PostgreSQL -version 14.4