diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81b018ad684f3a35fee301741b2734c8f4..0000000000000000000000000000000000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 5d8becd669a486480fc8a59decf9b0656b039317..0000000000000000000000000000000000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,7 +0,0 @@ -<component name="InspectionProjectProfileManager"> - <profile version="1.0"> - <option name="myName" value="Project Default" /> - <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" /> - <inspection_tool class="PyInterpreterInspection" enabled="true" level="INFORMATION" enabled_by_default="true" /> - </profile> -</component> \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da2d6447d11dfe32bfb846c3d5b199fc99..0000000000000000000000000000000000000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ -<component name="InspectionProjectProfileManager"> - <settings> - <option name="USE_PROJECT_PROFILE" value="false" /> - <version value="1.0" /> - </settings> -</component> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index e7161a1e7fa75fd7cd38b9c832cafd2f00378162..0000000000000000000000000000000000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="ProjectModuleManager"> - <modules> - <module fileurl="file://$PROJECT_DIR$/.idea/systemdev_hrproject.iml" filepath="$PROJECT_DIR$/.idea/systemdev_hrproject.iml" /> - </modules> - </component> -</project> \ No newline at end of file diff --git a/.idea/systemdev_hrproject.iml b/.idea/systemdev_hrproject.iml deleted file mode 100644 index 37512de08fe8c5d5cca096f2c3678d35d0b8f41c..0000000000000000000000000000000000000000 --- a/.idea/systemdev_hrproject.iml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module type="PYTHON_MODULE" version="4"> - <component name="NewModuleRootManager"> - <content url="file://$MODULE_DIR$" /> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> - <component name="PyDocumentationSettings"> - <option name="format" value="PLAIN" /> - <option name="myDocStringFormat" value="Plain" /> - </component> - <component name="TemplatesService"> - <option name="TEMPLATE_CONFIGURATION" value="Jinja2" /> - <option name="TEMPLATE_FOLDERS"> - <list> - <option value="$MODULE_DIR$/app/templates" /> - </list> - </option> - </component> -</module> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfbbc029bcab630581847471d7f238ec53..0000000000000000000000000000000000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="" vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/README.md b/README.md index 8cb8c1e6908018f1c8fa2d691906b15da687cffa..80833d196be51afed34e6b8e1c9223c5f68ccabb 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ ``` 3. Access the application - - The web application will be available at http://localhost:5000 - - MySQL database will be available at localhost:3306 + - The web application will be available at 127.0.0.1:5000 + - MySQL database will be available at 127.0.0.1:3306 ### Docker Environment Variables diff --git a/instance/config_example.py b/instance/config_example.py index 7af874eae2741b4bab79090d50520cd3f65b1c64..abddbbde71ce52290c766722eba755d8ba5879e3 100644 --- a/instance/config_example.py +++ b/instance/config_example.py @@ -1,10 +1,16 @@ +import os +from urllib.parse import quote_plus + +# Get database configuration from environment variables DATABASE_CONFIG = { - "host": "your_host", # insert your localhost to your_host - "user": "your_user", # inser your user to your_user - "password": "your_password", # insert your password to your_password - # (change @ to %40 if the last character of your password is @) - "database": "your_database", # insert your database to your_database + "host": os.environ.get("DB_HOST", "db"), + "user": os.environ.get("DB_USER", "hrapp"), + "password": os.environ.get("DB_PASSWORD", "changeme_in_production"), + "database": os.environ.get("DB_NAME", "hrms"), + "port": int(os.environ.get("DB_PORT", 3306)), } -DATABASE_URI = f"mysql+pymysql://{DATABASE_CONFIG['user']}:{DATABASE_CONFIG['password']}@{DATABASE_CONFIG['host']}:{DATABASE_CONFIG['port']}/{DATABASE_CONFIG['database']}" +# Use proper URL encoding for the password +encoded_password = quote_plus(DATABASE_CONFIG["password"]) +DATABASE_URI = f"mysql+pymysql://{DATABASE_CONFIG['user']}:{encoded_password}@{DATABASE_CONFIG['host']}:{DATABASE_CONFIG['port']}/{DATABASE_CONFIG['database']}" SQLALCHEMY_TRACK_MODIFICATIONS = False