# Delta-Carbon-EPC

## Intialize project locally

Run these scripts in order:

    scripts\install poetry.bat

    scripts\poetry virtual environment in-project.bat

    scripts\install epc.bat

    scripts\run server migrate.bat

    scripts\run server.bat

[Download and Install GTK2](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/download/2021-01-30/gtk2-runtime-2.24.33-2021-01-30-ts-win64.exe)

Ensure that "C:\Program Files\GTK2-Runtime Win64\bin;" is added to your systempath variables and moved to the top

Run the server with poetry in the virtual environment:

    poetry run python manage.py runserver

## Code-base structure

The project is coded using a simple and intuitive structure presented bellow:

```bash
< PROJECT ROOT >
    
    |--nginx                                    # Part of Volt template to be updated before production
    |
    |--scripts
    |   |-- <scripts>                           # Scripts to easily install see # Initialise project
    |
    |-- src                                     # Root folder for Django project 
    |   |-- app/                                # A simple app that serve HTML files
    |   |    |
    |   |    |-- views.py                       # Serve HTML pages for authenticated users
    |   |    |-- urls.py                        # Define some super simple routes
    |   |
    |   |-- authentication/                     # Handles auth routes (login and register)
    |   |    |
    |   |    |-- urls.py                        # Define authentication routes  
    |   |    |-- views.py                       # Handles login and registration  
    |   |    |-- forms.py                       # Define auth forms
    |   |
    |   |-- blockchain/                         # Certificates to be verified with blockchain 
    |   |    |
    |   |    |-- blockchain.py                  # Includes blockchain models 
    |   |
    |   |-- core/                               # Implements app logic and serve the static assets
    |   |    |-- settings.py                    # Django app bootstrapper
    |   |    |-- wsgi.py                        # Start the app in production
    |   |    |-- urls.py                        # Define URLs served by all apps/nodes
    |   |    |
    |   |    |-- static/
    |   |    |    |-- <css, JS, images>         # CSS files, Javascripts files
    |   |    |
    |   |    |-- templates/                     # Templates used to render pages
    |   |         |
    |   |         |-- includes/                 # HTML chunks and components
    |   |         |    |-- navigation.html      # Top menu component
    |   |         |    |-- sidebar.html         # Sidebar component
    |   |         |    |-- footer.html          # App Footer
    |   |         |    |-- scripts.html         # Scripts common to all pages
    |   |         |
    |   |         |-- layouts/                  # Master pages
    |   |         |    |-- base-fullscreen.html # Used by Authentication pages
    |   |         |    |-- base.html            # Used by common pages
    |   |         |
    |   |         |-- accounts/                 # Authentication pages
    |   |         |    |-- login.html           # Login page
    |   |         |    |-- register.html        # Register page
    |   |         |
    |   |      index.html                       # The default page
    |   |     page-404.html                     # Error 404 page
    |   |     page-500.html                     # Error 404 page
    |   |       *.html                          # All other HTML pages    
    |   |
    |   |-- requirements.txt project.toml       # Development in progress to be updated
    |   |
    |   |-- .env                                # Inject Configuration via Environment
    |   |-- manage.py                           # Start the app - Django default start script
    |   
    |--requirements.txt                         # Automatically generated by Poetry. Used to deploy on Heroku 
    |
    |--docker-compose.yml                       # For local container testing 
    |
    |--Dockerfile                               # Image instructions
    |
    |--gunicorn-cfg                             # Webservers redirect config to be updated
    |
    |-- ************************************************************************
```

# Code formatter 
Black
Follows PEP8