- Python
- Flask
- MongoDB
- Python 3.10.1 or higher
- MongoDB server 4.4.6
- Python packages described in
requirements.txt
file
-
Clone this repository:
git clone https://github.com/EnderASz/Guiden.git
-
Enter into cloned repository directory (usually by
cd Guiden
)
- If you want to use virtual environment activate it before steps below
-
Run
pip3 install -r requirements.txt
to install required python packages -
Go to Configuration and configure application via environment variables (and/or by creating
.env
file) or in config file setted byGUIDEN_CFG
enviroment variable.
Entire configuration below can be done only by creating and modifying below environment
variables or putting them into .env
file.
Variable name | Default value | Optional | Description |
---|---|---|---|
FLASK_RUN_PORT | 5000 |
✅ | Port from which you want to publish app |
FLASK_RUN_HOST | localhost |
✅ | Host address from which you want to starts app |
FLASK_ENV | production |
✅ | In development process (only) probably you want set this to development . In production it's recommended to set this to production . |
FLASK_APP | ➖ | If you running app by flask run |
That should be set to Guiden - Application main package |
GUIDEN_CFG | ➖ | ✅ | Application configuration file path |
Variable name | Default value | Optional | Description |
---|---|---|---|
SECRET_KEY | By default application use constant predefined key | ✅ | Secret Key for application instance. In production we recommend to provide it and keep it in secret. |
MONGO_HOST | localhost |
❌ | Database server host address |
MONGO_PORT | 27017 |
❌ | Database server port number |
MONGO_USER | ➖ | ✅ | Database server authentication username |
MONGO_PASS | ➖ | ✅ | Database server authentication password |
MONGO_DBNAME | Guiden |
❌ | Uses database name |
MONGO_OPTS | ➖ | ✅ | Database server connection options |
Simply just run command below in the main repository location
flask run
For now, try to guide with this site. Currently we are not sure whether our application can be properly runned in production by default.
Propably in the future we will provide support and own guide for this.
If you need to import main flask app file into WSGI probably it would be this
same package, which is pointed by FLASK_APP
enviroment variable.
To check availble app CLI commands simply run below command:
flask --help
Look here: Flask documentation - Run the Development Server
Look here: Flask documentation - Open a Shell
To show application url routes and endpoints simply run below command:
flask routes
That command should show you a table design like the one below:
Endpoint | Methods | Rule |
---|---|---|
[subapp.]endpoint_name |
METHOD_NAME |
/url/rule/<parameter_type:parameter> |
static |
GET |
/static/<path:filename> |
home.home |
GET |
/home |
home.home |
GET |
/ |
... | ... | ... |
Application structure and functionality documentation is available here.