From 8a0d7e3576619d5c49480351dcb932306380ac45 Mon Sep 17 00:00:00 2001 From: Teddy Middleton-Smith Date: Tue, 25 Feb 2025 17:36:23 +0000 Subject: [PATCH] Fix(Content): Corrected build instructions in and format of README. --- README.md | 97 ++++++++++++++++++++++++++++++++++++++++++++++--------- config.py | 2 +- 2 files changed, 82 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 4be183be..4fb71b5a 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,104 @@ -Precision and Research Technology Systems Limited -Website with online store +## demo_partsERP +Demo subproject of partsERP Enterprise Resource Planning system featuring the core product functionality. +This web app uses Python with Flask for the server and MySQL for the database. -Powered by flask +## Build And Run +# 0. Prerequisites +- Python 3.10 +- npm +- Locally hosted MySQL database -enter virtual environment: -python -m venv VIRTUAL_ENVIRONMENT_NAME +# 1. Create Auth0 application for project -run module bundler: +# 2. (Optional) Create Google ReCAPTCHA service +NOTE: IF CONTACT US PAGE FORM FUNCTIONALITY IS REQUIRED, COMPLETE THIS STEP. +2.1. Go to the reCAPTCHA Admin Console and register your site: https://www.google.com/recaptcha/admin +2.2. Choose reCAPTCH v2 +2.3. Generate and save keys for step 10 + +# 3. (Optional) Create bot email account +NOTE: IF CONTACT US PAGE FORM FUNCTIONALITY IS REQUIRED, COMPLETE THIS STEP. +3.1. Using your chosen email provider, create a new account for sending emails from the web server + +# 4. Create and populate database +4.1. Sign into your local MySQL workspace +4.2. Run script static/MySQL/0000_combined.sql + +# 5. Open the project in a new terminal window +5.1. Open a new terminal window +5.2. Navigate to the project with the following command +- cd path/to/project/main/directory + +# 6. Create virtual environment +6.1. Terminal command +python3 -m venv env_demo_partsERP + +# 7. Enter virtual environment +7.1. Terminal command +source env_demo_partsERP/bin/activate + +# 8. Run module bundler +8.1. Terminal command npm run build -host for machine: -python -m flask run +# 9. Install required python packages +9.1. Terminal command +pip3 install -r requirements.txt -host for local network: -python -m flask run --host=0.0.0.0 +# 10. Set required environment variables +10.1. Windows command +SET variable_name=variable_value + +10.2. Linux command +export variable_name=variable_value + +10.3. Required variables +| Name | Purpose | Example Value | +| -------- | -------- | -------- | +| KEY_SECRET_FLASK | Private key for server encryption. | password123 | +| ID_AUTH0_CLIENT | Public identifier for project's Auth0 application. | erDasdku8asdncuSAAS88C71nSioRR2r | +| ID_AUTH0_CLIENT_SECRET | Private key for project's Auth0 application. | erDasdku8asdncuSAAS88C71nSioRR2rerDasdku8asdncuSAAS88C71nSioRR2r | +| DOMAIN_AUTH0 | Domain for requests related to project's Auth0 application. | dev-pdjf9043dsau7fas8fs.us.auth0.com | +| SQLALCHEMY_DATABASE_URI | Database connection string for SQLAlchemy. | mysql://db_user_name:db_password@127.0.0.1:3306/db_name | +| URL_HOST | Domain (and port as necessary) that the project is hosted on. | https://127.0.0.1:5000/ | + +10.4. Optional variables +| Name | Purpose | Example Value | +| -------- | -------- | -------- | +| MAIL_DEFAULT_SENDER | Bot email address. Required for sending internal emails following form completion on Contact Us page. | bot@partsltd.co.uk | +| MAIL_CONTACT_PUBLIC | Company's public communications email address. Required for receiving internal emails following form completion on Contact Us page. | teddy@partltd.co.uk | +| MAIL_PASSWORD | Password for bot email account. Required for receiving internal emails following form completion on Contact Us page. | password123 | +| RECAPTCHA_PUBLIC_KEY | Public key for Google ReCAPTCHA. Required for bot-prevention mesaures on Contact Us page form.| erDasdku8asdncuSAAS88C71nSioRR2rerDasdku | +| RECAPTCHA_PRIVATE_KEY | Private key for Google ReCAPTCHA. Required for bot-prevention mesaures on Contact Us page form. | erDasdku8asdncuSAAS88C71nSioRR2rerDasdku | + +# 11. Host project +Either +11.1. Host for local machine: +python3 -m flask run + +11.2. Host for local network: +python3 -m flask run --host=0.0.0.0 -files dedicated to each page: -CSS +## File Structure +# Files dedicated to each page +CSS: page -HTML +HTML: page row -JavaScript +JavaScript: page api router base - navigation buttons -MySQL +MySQL: get save table staging table audit table -Python +Python: business object controller datastore diff --git a/config.py b/config.py index 2b758339..6091513f 100644 --- a/config.py +++ b/config.py @@ -99,7 +99,7 @@ class ProductionConfig(Config): # Set the configuration class based on the environment # You can change 'development' to 'production' when deploying -config_env = os.getenv('FLASK_ENV', "development") +config_env = os.getenv('FLASK_ENV', "production") with open('app.log', 'a') as f: print(f'config_env: {config_env}') f.write(f'config_env: {config_env}\n')