Create venv named venv inside root folder
Activate it
Install requirements.txt
$ python -m pip install -r requirements.txt
You may also want to install dev_requirements.txt
$ python -m pip install -r dev_requirements.txt
We are using MySQL but you can have a stab at a different db.
Create a db named traveller or whatever you want in your MySQL db.
Setting up MySQL Database on Linux(if this is your first time with using MySQL database )
- Start MySQL database
$ systemctl start mysql
(or)
$ service mysql start
- After starting MySQL database, login into the shell
$ mysql
- Create a database
mysql > CREATE DATABASE traveller;
- This will create the database in your local MySQL server, you can exit the Mysql shell and complete the remaining steps
Change directory to the traveller folder
$ cd traveller
Create folder called instance and a file called config.py in it
$ mkdir instance #auto ignored by git
$ touch instance/config.py
In instance/config.py set the SQLALCHEMY_URI. For MySQL it will be like this (the file should contain only that):
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:root@localhost/traveller'
'mysql+pymysql://username:password@localhost/dbname'.
Create or edit traveller/config.json with the information needed for each environment.
for development:
{
"environment": "development",
"admin_user": {
"email": "admin@domain.com",
"password": "pass"
},
"settings": {
"APP_NAME": "Demo",
"ACTIVE_FRONT_THEME": "blogus",
"ACTIVE_BACK_THEME": "boogle",
"CURRENCY": "MUR"
}
}
and for production:
{
"environment": "production",
"admin_user": {
"email": "admin@domain.com",
"password": "pass"
},
"settings": {
"APP_NAME": "Demo",
"ACTIVE_FRONT_THEME": "blogus",
"ACTIVE_BACK_THEME": "boogle",
"CURRENCY": "MUR"
}
}
Now in traveller/traveller run:
$ python manage.py initialise
Then, to get development example data (make sure requirements in dev_requirements.txt are installed)
$ flask seed dev
Then
$ python manage.py rundebug
Migrations:
$ python manage.py db migrate
$ python manage.py db upgrade
More info can be found in the shopyo docs: shopyo.readthedocs.io
We are using flask-mailman.
If you have Node.js, use the maildev package. Install it using
$ npm install -g maildev
Then serve it using
$ maildev
Dev configs for this setup are (already in config.py):
class DevelopmentConfig(Config):
"""Configurations for development"""
ENV = "development"
DEBUG = True
LOGIN_DISABLED = False
# control email confirmation for user registration
EMAIL_CONFIRMATION_DISABLED = False
# flask-mailman configs
MAIL_SERVER = 'localhost'
MAIL_PORT = 1025
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_USERNAME = '' # os.environ.get("MAIL_USERNAME")
MAIL_PASSWORD = '' # os.environ.get("MAIL_PASSWORD")
MAIL_DEFAULT_SENDER = 'ma@mail.com' # os.environ.get("MAIL_DEFAULT_SENDER")
Go to http://127.0.0.1:1080 where it serves it’s web interface by default. See mails arrive in your inbox! Particularly useful when registering!
Go to traveller/traveller
$ python -m pytest .
Go to: http://127.0.0.1:5000/dashboard
Login with username: admin@domain.com and password: pass
Click on admin and create a new role called reviewer
Add new people and assign them the roles
Go to dashboard and click on conf
Create a new conf
Add reviewers to conf
Go to: http://127.0.0.1:5000/y/2021/
We'll db seed some folks soon