Intelligent Show Room (ISR)
Prerequisite:
- Python 2.7
- MySQL Install Guide
- Redis Install Guide
- Nodejs Install Guide
- Grunt Install Guide
Steps:
- Clone project code
$ git clone [email protected]:5peng/ucdip.git
- List item
$ cd ucdip/isr/
$ virtualenv venv
- Activate venv
$ source venv/bin/activate
- Setup database
$ mysql -uroot -p
mysql > CREATE SCHEMA `isr` DEFAULT CHARACTER SET utf8;
mysql > CREATE USER 'isr'@'localhost' IDENTIFIED BY 'welcome';
mysql> GRANT ALL PRIVILEGES ON isr.* TO 'isr'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ export DATABASE_URL=mysql://isr:1qaz2wsx@localhost/isr?charset=utf8
- Setup redis
export REDIS_URL=redis://:foobared@localhost:6379
- Run app
make run-all
- Test application
$ export MODE=debug
$ python manage.py runserver
$ curl http://127.0.0.1:5000/api/stores/2/sales
The application runs OK if an empty json array is returned.
Others:
- Setup supervisor
$ cp deploy/gunicorn.conf.sample deploy/gunicorn.conf # make changes as you want
$ cp deploy/isrd.conf.sample deploy/isrd.conf # make changes as you want
$ cp deploy/celeryd.conf.sample deploy/celeryd.conf # make changes as you want
Then add isrd.conf and celeryd.conf to /etc/supervisor.conf
-
Config nginx to dispatch request to gunicorn
-
Grunt tasks
- compile all scss and combine js files in projects with source map, without source code compress.
$ grunt dev
- compile all js files only (combine all js, without compress)
$ grunt shampoo:dev
- compile all scss files with source map, without compress.
$ make sass:dev
- compile all scss with source map and combine js files, with js files modify watcher (will automatic update target js after file changes).
$ grunt watch
- combine all js files (only) without compress and watch js file changes.
$ grunt shampoo:watch
- Load lookups
- Setup lookups for a new store
$ python manage.py lookup setup -s <store_id>
- Reload lookupvalues for a lookup
$ python manage.py lookup reload --id <lookup_id> -l <lookup_values_csv_location>