Change Flask Root Folder for Templates and Static Files

Today I was facing a problem, I didn’t know how to change Flask root directory. Flask by default look for templates and static files under the root directory (/), how can we change that? Changing the root path Here’s my directory structure: . ├── api_files │ ├── static │ │ └── style.css │ └── templates │ └── index.html ├── api.py ├── Pipfile └── Pipfile.lock 3 directories, 5 files I want Flask to be able to process the folders static and templates inside the api_files folder, my main Flask app is api....

<span title='2018-05-12 13:55:57 +0000 UTC'>May 12, 2018</span>&nbsp;·&nbsp;1 min&nbsp;·&nbsp;Franccesco Orozco

Deploy a Flask Project to Heroku

I was suddenly in the need of deploying a very basic Flask API to the cloud, so it can be available to the public. The thing is, Flask is not made for a production and scalable environment, but if you only need to deploy a very basic web server to Heroku then this guide is for you. Initialize a repository First of all we will need to set up a virtual enviroment with Pipenv, a Flask app, and initialize a repository....

<span title='2018-05-10 21:26:58 +0000 UTC'>May 10, 2018</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;Franccesco Orozco

Create a Basic API With Flask

What is Flask? Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. Flask is a microframework for Python that you can use to quickly create API’s and websites. It’s a great and easy to use platform, let’s create a simple API, but first we will go through the basics. Flask Installation We’re going to install Flask in our virtual environment to later import it into our code....

<span title='2018-04-07 22:20:50 +0000 UTC'>April 7, 2018</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;Franccesco Orozco