My file structure is as follows
api --> where all my flask api is
build
src
package.json
I have successfully made a git repository out of the api and pushed it to my heroku account.
I am having trouble deploying the front end with this file structure. Blog posts and youtube videos I have came across show deployment with the python file inside of the main folder and not structured in a different folder of its own.
I was wondering how I should go about deploying with this file structure. This is the first time I am deploying and I would be grateful if someone could walk me through it.
This is my deployment of angular project with flask. But most of the procedure is same for react also. Link
Keep Procfile, wsgi.py and runtime.txt in root along with package.json. Do changes in wsgi.py import statement.
Related
tldr; - When I have deployed a flask app in the past, it uses a requirements.txt file in the main root of the project folder so that azure or heroku can understand what modules need to be installed. However, this is the first time I am messing with django. I am trying to test deploy to azure or heroku but I azure can't detect the stack of the app because there is no requirements.txt file in the main root of the folder.
From messing with django a little bit, it seems alot more complicated than flask. What can I do to test deploy the most basic app to azure app services or heroku or aws or any place in general?
I tried deploying the django app like I normally do with flask but received an error:
Could not auto-detect the runtime stack of your app.
HINT: Are you in the right folder?
For more information, see 'https://go.microsoft.com/fwlink/?linkid=2109470'
Here is a picture of what I am seeing on my side:
I would assume I am not in the right folder but I am not sure if that is the problem completely.
Here is app I am testing myself. Its a microsoft authenication test app where you can test your xbox live account, microsoft school account, or microsoft work account against the webpage: https://github.com/Azure-Samples/ms-identity-python-django-tutorial
**Of course I added the app registration information from azure. Infact, the same app registration information works on my flask app so any azure app registrations issues is probably not the issue. **
The repo you link contains multiple projects. It sounds like you need to clone this, then move one of the project sub-directories (which should have its own requirements.txt already) into a fresh working tree, initialize a new repo there, and then push that to the cloud provider.
I am building a web app with a Flask backend and a React front end, and I would now like to deploy it, buy a domain, and set it up. What is the easiest way to do this?
Here's my research:
This website shows how to deploy an app on Heroku. I did this, but Heroku seems to be unavailable a lot, at least today.
This blog post seems to suggest I could create a GCE instance and run things there, though (i) it seems like a little more configuration that I'd like (ii) I would need a way to link the nginx server to my domain. I suppose the benefit is that the two apps run on the same machine?
This SO post had OP redo his work and it somehow worked. I'm not sure how to deploy Docker apps online, though.
Is there an easy way to deploy to a reliable service (Google Cloud/AWS/Azure)? My code has the following structure:
build/ # Result of `yarn build`
server/
server.py # Flask server
src/ # React code
Component/
Component.js
Component.sass
index.css
index.js
...
public/
index.html
# Images and other stuff.
I figured out how to do this using Azure. I created an App Service, then installed the Azure Tools VS Code extension. You need to move the Python server to the root directory and rename it to app.py (so the .env is also in the root folder), and then you can right-click your App Service in VS Code (in the Azure Tools tab) and then click Deploy to Web App. Easy!
I followed this Large Flask Applications tutorial and changed my main.py into __init__.py. Now, running the app locally uses flask run instead of python main.py.
The problem: when I deploy the app, I get a 502 Bad Gateway error obviously. I know that, by default, App Engine will look for the main.py file as an entry point.
But now that the entry point has changed, what can I do?
Can Google App Engine work with large Flask apps?
As per the documentation The Python Runtime, you can change the entrypoint value in the app.yaml file, so it would redirect your __init__.py file.
Besides that, I would recommend you to take a look at the following links, where there is more information, regarding building and developing an application with Python and Flask.
Building a Python 3.7 App on App Engine
Python App Engine 2017: Building a simple Flask app
These links should provide a good overview of development with these two applications, which should cover how to avoid such errors that you are facing.
Let me know if the information helped you!
I am trying to run through the creation of a Flask web app in Azure using this instruction page.
Creating Web apps with Flask in Azure
In the "Application Overveiw" section, it lists some FlaskWebProjectfiles saying.
Here's an overview of the files you'll find in the initial Git repository
\FlaskWebProject\__init__.py
\FlaskWebProject\views.py
\FlaskWebProject\static\content\
\FlaskWebProject\static\fonts\
\FlaskWebProject\static\scripts\
\FlaskWebProject\templates\about.html
\FlaskWebProject\templates\contact.html
\FlaskWebProject\templates\index.html
\FlaskWebProject\templates\layout.html
The problem is that I don't get these files when I connect up Azure to a Github repository. I know they exist because my Azure app renders the this default Flask webapp. The files exist in /wwwroot.
I am sure that I am missing something obvious here, so if anyone has followed the most recent Flask setup instruction for Azure, and had success, their input would be great.
Your initial GitHub repository is empty, so you need to clone the repository.
The process is described in the same article you mentioned, but a little later.
Basically:
1) Go to the deployment source and configure the deployment source - for example, local github
2) Go to Settings => Properties. Here you should have Git URL where your files are placed
3) Go to your workstation, and execute
git clone https://yourdeploymentusername#todeleteflask.scm.azurewebsites.net:443/todeleteflask.git
Enter password.
You should be all set now. Now, if you make change, you may push to the repository and it will arrive on the site.
I have a site that's running fine locally. I used this resource (https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/) to push it up to my Azure Flask web app via Git. However, when navigating to the url given by the project:
it looks like this:
, which is not my home page. Any idea why this is happening or what I can do to fix it? Thanks!
Per my experience, assumption that you created the webapp for using Flask via creating a Flask template from gallery on Azure old portal or from marketpacke on Azure new portal, so that the template project for Flask called FlaskWebProject would be created by following the webapp. You can see the template project at the path \site\wwwroot of the Kudu console http://<your-webapp-name>.scm.azurewebsites.net/DebugConsole.
Therefore, you need to cover the project with your project called the same name via Git. Your project directory must be in the root path of Git repository.
The root path of Git repo
|- FlaskWebProject
|- ...
Then, it will cover the old project when you pull the git repo via continuous deployment on Azure.
If using Visual Studio as your default IDE, you can refer to the doc https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-flask-app/.