ows-salessheets
===============

## Getting Started

### Installation

The installation is very straightforward, but make sure you are using at least
python 3.13. If you use a Mac, you can install it using `brew`. If you use
Windows, just ask for a remote VM that has it installed for you.

```bash
$ cd flask-eb
$ pyvenv env
(env) $ . env/bin/activate
(env) $ pip install -r requirements.txt
(env) $ pip install -r requirements-dev.txt
```


## Environment Variables
Variable | Description | Default
-------- | ----------- | -------
Environment | (dev, test, qa, prod) | dev
AR_MYSQL_DATABASE | art_relations is database that will be used for taking release ids by UPC | 
AR_MYSQL_HOST | Host of art_relations database | 
AR_MYSQL_PASSWORD | Password of art_relations database user | 
AR_MYSQL_PORT | Port of art_relations database | 
AR_MYSQL_USER | Username of art_relations database user | 
SS_MYSQL_DATABASE | salessheets is database that will be used for store info about generated bulk salesshets | 
SS_MYSQL_HOST | Host of salessheets database | 
SS_MYSQL_PASSWORD | Password of salessheets database user | 
SS_MYSQL_PORT | Port of salessheets database | 
SS_MYSQL_USER | Username of salessheets database user | 
AWS_REGION | Amazon region | us-east-1 
AWS_ACCESS_KEY_ID | Amazon Access Key ID | 
AWS_SECRET_ACCESS_KEY | Amazon Secret Access Key | 
SENTRY_DSN | Exception alerting. Example: export SENTRY_DSN=https://&lt;token&gt;@app.getsentry.com/87050. Uncaught exceptions will automatically go to Sentry. Caught exceptions can be sent to Sentry by calling: capture_exception() | 
LOGGER_DSN | Loggly https event endpoint for QA and Prod environments. Example value: https://logs-01.loggly.com/inputs/TOKEN/tag/ows1 | 
BULK_SALESSHEETS_S3_DIRECTORY | Directory where results of daemon generation are stored |

### Running

When all dependencies have been installed, you can run the flask application
on your local instance by running:

```bash
(env) $ python dev.py
```

or

```bash
make dev
```

By using the development server, you will have access to specific features that
are not necessarily available in production, such as the exception tracer.

### Testing

To run the tests, all you have to do is to run:

```bash
(env) $ py.test tests/ --cov salessheets --cov-report term-missing
(env) $ flake8 salessheets/ tests/
```

or

To run tests: `make test`

To lint: `make lint`

### Updating

To install new dependencies.

```bash
(env) $ pip install -r requirements.txt
(env) $ pip install -r requirements-dev.txt
```

or

```bash
make pip_dev
```

### Notes

Windows users will not be able to use the `make` commands as Make is a Unix util.
Windows users can attempt to install [GNUWin](http://gnuwin32.sourceforge.net/packages/make.htm) to get this functionality.
