{"id":13500525,"url":"https://github.com/squadran2003/flask-bootstrap-apache-template","last_synced_at":"2025-03-29T07:31:05.329Z","repository":{"id":41225590,"uuid":"48843308","full_name":"squadran2003/flask-bootstrap-apache-template","owner":"squadran2003","description":"A base template for flask app with all the css files included for twitter bootstrap, also included a wsgi file for deployment to a apache server.","archived":false,"fork":false,"pushed_at":"2019-03-04T15:15:29.000Z","size":4146,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T19:36:52.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/squadran2003.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-31T09:11:17.000Z","updated_at":"2024-04-25T16:57:41.000Z","dependencies_parsed_at":"2022-08-26T09:21:07.914Z","dependency_job_id":null,"html_url":"https://github.com/squadran2003/flask-bootstrap-apache-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squadran2003%2Fflask-bootstrap-apache-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squadran2003%2Fflask-bootstrap-apache-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squadran2003%2Fflask-bootstrap-apache-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squadran2003%2Fflask-bootstrap-apache-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squadran2003","download_url":"https://codeload.github.com/squadran2003/flask-bootstrap-apache-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246155985,"owners_count":20732355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:01:04.087Z","updated_at":"2025-03-29T07:31:04.923Z","avatar_url":"https://github.com/squadran2003.png","language":"HTML","readme":"## flask-bootstrap-apache-template\nA base template with correct folder structure for a flask app,the template also has all the css files for twitter bootstrap, also included a wsgi file for deployment to a apache server.\n\n## Motivation\n  The idea for this template came from building a few flask web apps. I found it a bit tedious to recreate all the folders,html files etc. This template aims to also make deployment to a apache2 server easy. The one aspect of coding that made me want to pull my hair out was deployment. I hope this template and guide makes using and deploying flask apps easier for other developers.\n  \n## Example\n\n```python\n\nFolder Hiearchy\n\nYourApp\n   templates\n   static\n     css\n      .css files\n     js\n       .js files\n   app.py\n   yourapp.wsgi\n\n```\n\n## Guide\n\n1) Download the zip file and extract to the location of choice\n\n2) Navigate to your YourApp/venv and edit the requirements.txt file to include the packages your app requires.\n\n3) Rename the folder called YourApp to your app name.\n\n4) Rename the .wsgi file to your app name, preferably in lowercase to the app name\n\nFor example lets say we had a folder called FlaskApp which holds all your flask apps on the server, and your app your are deploying was called TEST, your folder structure on the server should look like this once deployed.\n\n```python\n\nFlaskApp\n  TEST\n    static\n    templates\n    venv\n    app.py (*** rename this to __init__.py when the folder is deployed to the server)\n  test.wsgi\n\n```  \n\n\n5)Once your folder is deployed to the server, navigate to TEST/venv and type the\n  command virtualenv.(the period represents the current directory) and will install all python dependencies in the venv folder. \n\n6)Still in the folder venv type the command source bin/activate which will activate the virtualenv.\n  Then install all packages required by your app by running the command pip install -r requirements.txt.\n\n7)Edit the test.wsgi file and change the commands as required  \n\nThe wsgi file for deploying this app would look like this if your app was called TEST.\n\n```python\n\n#!/usr/bin/python\nimport sys\nimport logging\n\nactivate_this = '/var/www/FlaskApp/TEST/venv/bin/activate_this.py'\nexecfile(activate_this, dict(__file__=activate_this))\n\nlogging.basicConfig(stream=sys.stderr)\nsys.path.insert(0,\"/var/www/FlaskApp/\")\n\nfrom TEST import app as application\napplication.secret_key = 'Add your secret key'\n\n```\n\n8) Next create a .conf file in your site-available folder by running the following command below.\n\n```python\n\nnano /etc/apache2/sites-available/TEST.conf  where TEST is the name of the app\n\n```\n\n####example content for the TEST.conf file\n\n```python\n\n\u003cVirtualHost *:80\u003e\n\t\tServerName mywebsite.com\n\t\tServerAdmin admin@mywebsite.com\n\t\tWSGIScriptAlias / /var/www/FlaskApp/test.wsgi\n\t\t\u003cDirectory /var/www/FlaskApp/TEST/\u003e\n\t\t\tOrder allow,deny\n\t\t\tAllow from all\n\t\t\u003c/Directory\u003e\n\t\tAlias /static /var/www/FlaskApp/TEST/static\n\t\t\u003cDirectory /var/www/FlaskApp/TEST/static/\u003e\n\t\t\tOrder allow,deny\n\t\t\tAllow from all\n\t\t\u003c/Directory\u003e\n\t\tErrorLog ${APACHE_LOG_DIR}/error.log\n\t\tLogLevel warn\n\t\tCustomLog ${APACHE_LOG_DIR}/access.log combined\n\u003c/VirtualHost\u003e\n\n```\n\n9) then run the command a2ensite TEST.\n\n10) Lastly we need to give apache access to the folders. navigate to\n    \n    /var/www/FlaskApp and type the command\n\n    chown -R www-data:www-data TEST\n\n11) run the command\n  \n    service apache2 reload\n\nThis should be all your need to deploy your app to a apache server.\n\n","funding_links":[],"categories":["HTML"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquadran2003%2Fflask-bootstrap-apache-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquadran2003%2Fflask-bootstrap-apache-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquadran2003%2Fflask-bootstrap-apache-template/lists"}