# macao-pos ## Installation The only requirements are Python 3 and virtualenv as you're going to install all the modules through pip. If you're using MySQL or PostgreSQL create now a new user and database. You can also use SQLite for testing purposes. ``` cd /var/www git clone ... cd macao-pos virtualenv -p python3 env source env/bin/activate pip install -r requirements.txt ``` Now you need to configure this software. Inside `doc/` you'll find some examples. The default path for configurations in `conf/` but you can also use `~/.config/pos`, `/usr/local/etc/pos` and `/etc/pos` that will be checked in this order. For a testing environment you can just do: ``` mkdir conf cp docs/config_core/core_debug_sqlite.ini conf/core.ini cp docs/config_logging/logging_debug.yaml conf/logging.yaml ``` and you're ready to go. For a production environment: ``` cd /var/www/macao-pos mkdir conf cp docs/config_core/core_production_mysql.ini conf/core.ini cp docs/config_logging/logging_production.yaml conf/logging.yaml ``` and then edit the conf/core.ini file to adjust the database params. Don't forget to change the SECRET_KEY value (`openssl rand -hex 32` will help you). If you want to change the log file path open your `conf/logging.yaml` and change the `filename` field of the `file` entry inside the `handlers` category. ## Building the database You also need to add some entries to the database. First of all add a new user. Get inside the virtualenv and then just do: ``` python3 cli.py user add username password ``` Add some products with: ``` python3 cli.py product add "Birra media" 300 python3 cli.py product add "Birra grande" 400 python3 cli.py product add "Cocktail" 500 python3 cli.py product add "Vino" 400 python3 cli.py product add "Amaro" 200 python3 cli.py product add "Acqua" 100 ``` And finally add and event you can play with: ``` python3 cli.py event add "My party" --start "2017-03-19 22:00" --end "2017-03-22 07:00" ``` ## Running You can run this software with from the virtualenv with: ``` python3 web.py ``` If you want to use a read httpd you can setup uwsgi as follows: ``` [uwsgi] socket = 127.0.0.1:9000 chdir = /var/www/macao-pos wsgi-file = web.py virtualenv = env master workers = 1 max-requests = 200 harakiri = 30 die-on-term ``` ## Contributing Fork → commit → pull request