Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

Latest commit

 

History

History
88 lines (52 loc) · 2.26 KB

README.MD

File metadata and controls

88 lines (52 loc) · 2.26 KB

OptomCalc

Build

Calculations for Optometry

By Shivan Sivakumaran

Introduction

The is a website that contains common calculations performed by Optometrists and Optical Dispensers.

The site is live

How this works

Setting up the .env files

Below is the .env files which is stored in /app.

SECRET_KEY=<django secret key>
SENTRY=<DSN>

Running in development

To run locally run:

make run

Production Set up

Ansible playbooks are used to set up the application on a 'production' server. The code for this can be found here.

This includes the nginx and certbot set up, which are on the server. The postgresql database, django and gunicorn app sit inside their own docker containers.

Gunicorn is used as a the wsgi service.

Docker-compose is used to orchestrate the entire project:


$ sudo docker-compose up --build

Local running

This is weird and I'm sure there are plenty workarounds. Since I do not have nginx running on my local machine, if I run the docker-compose command as if it were in production, the site will work. However, I will not have any static files. This is because nginx serves those static files. I use docker-compose to spin up at postgresql database and then run:


$ pipenv run python manage.py runserver

to create a local django instance, which is connected to the dockerised postresql database. I can a function application with static files that I can then make edits to my code.

Code structures

Below is how the application is structured


├── db-data # Database
├── optomcalc
│   ├── calculator # application or 'calculator' code
│   │   ├── templates
│   │   │   └── calculator
│   │   └── tests
│   ├── optomcalc # admin app
│   └── static # static files for nginx
│   └── calculator
│   ├── css
│   └── js

Feedback

Please contact me if you have any questions.