Heroku crashed when following Basic Auth example on Plotly Dash website - authentication

After following the Deploying Dash Apps on Heroku example, I then changed app.py to the Basic Auth Example on the Plotly Dash website. My Heroku site then crashed as a result. How do I make the example work on Heroku?

Looking through the Heroku logs, I found two errors:
ModuleNotFoundError: No module named 'requests'
Failed to find attribute 'server' in 'app'.
I installed the requests library, making sure to update requirements.txt. (Not sure if this step was necessary, but it was the first error I fixed.) In the Basic Auth Example, you will notice server = app.server is not present, but is present in Deploying Dash Apps. Once I added the server info, everything worked:
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
server = app.server

Related

how to properly see the errors of a flask application in production mode

I have made a flask application at my local computer in the debugging mode and it runs all fine. But when it comes to production, the website gives me 500 or internal server error, which I have no idea what the bug is. I am fairly new to flask production and this has been stopping me from moving forward for quite a few days.
My questions are:
1> in my local development environment, one could always print things out. But how can I see those prints in the production stage?
2> Do I see them through Apache2 log? Where is Apache2 log?
For production, I actually followed the tutorials from pythonprogramming.net. Youtube link is here:
https://www.youtube.com/watch?v=qZNL4Ku1UQg&list=PLQVvvaa0QuDc_owjTbIY4rbgXOFkUYOUB&index=2
To use a very simple example, if the code imports a package which wasn't installed, where can we see the errors?
Thanks in advance.
I've tried to use to use try ... except block for every flask function. Whenever there is an exception, it can be return to the front-end. But what about other errors?
I found out:
Use logging module
Read apache2 log from /var/log/apache2

UMBRACO 10 HTTP Error 500.30 - ASP.NET Core app failed to start

I am trying to deploy my Website with umbraco 10, I always get the following error:
HTTP Error 500.30 - ASP.NET Core app failed to start
The website works correctly locally, however when deploying the app I get the same error...
Details:
DB SQL Server
Azure WebApp .Net6
What i have tried
I have followed the instructions: https://our.umbraco.com/documentation/Fundamentals/Setup/Server-Setup/azure-web-apps
I have created a project from scratch, thinking that the problem was some package, but still the same error.
This is how my umbraco 10 application looks once deployed from VS to an appservice (Azure)
The first thing I would do is check the logs on the the environment where you have deployed the code. That should give you a better idea what is actually going wrong as the error you are getting is very generic and not that helpful.
I have seen issues where the media folder is missing and that is something to check.
When I have issues in Azure, I also look at the files via the Azure Portal and check the connection string and any other configurations files to ensure they look correct. It could be the deployment has screwed up some values.
Have a look at this post which may provide some further details - https://our.umbraco.com/forum/using-umbraco-and-getting-started/108288-getting-http-error-50030-after-successful-publishing-to-azure

Frontend no longer accessible after dependency updates

We have a rather standard web app, that consists of a Flask backend and a Vue.js frontend. In production, we use uWSGI to serve that application. We have uWSGI configured to serve frontend pages and access backend calls for their respective routes.
[uwsgi]
module = app
callable = create_app()
buffer-size=65535
limit-post=0
wsgi-disable-file-wrapper=true
check-static=./public
# enable threads for sentry
enable-threads = true
# dont show errors if the client disconnected
ignore-sigpipe=true
ignore-write-errors=true
disable-write-exception=true
; redirect all frontend requests that are not static files to the index
route-host = ^$(FRONTEND_HOST_NAME)$ goto:frontend
; also handle if the host name is frontend, for the dokku checks
route-host = ^frontend$ goto:frontend
; continue if its a backend call
route-host = ^$(BACKEND_HOST_NAME)$ last:
route-host = ^backend$ last:
; log and abort if none match
route-run = log:Host Name "${HTTP_HOST}" is neither "$(FRONTEND_HOST_NAME)" nor "$(BACKEND_HOST_NAME)"
route-run = break:500
route-label = frontend
route-if = isfile:/app/src/backend/public${PATH_INFO} static:/app/src/backend/public${PATH_INFO}
route-run = static:/app/src/backend/public/index.html
This worked perfectly fine and behaved just like our dev setup, where we use containers for both front- and backend. But after the update of some vulnerable dependencies, trying to access the frontend results in a 404.
In the frontend we moved from vue-cli ~4.5.9 to ~5.0.4. We long suspected that this might be the main issue, but we're not so sure about that anymore.
We also upgraded from Flask ~1.1 to ^2.0.3 but we kept the version 2.0 of uWSGI. The configuration of that should therefore probably not have changed.
We're treading in the dark on this one. Does anyone of you have any idea on what might be going wrong in here?
I tried to isolate the problem by creating a rather small setup, but have not been able to track down the underlying issue until now.
I have no idea what it exactly was, but I did in the end upgrade each dependency one by one until all of them were upgraded and things still worked. It must have been something related to the Dockerfile that we use. That one is now slightly more like the old one rather than the one I used previously to doing things one by one.

Validation Error on app upload

I want to deploy my app to the shiny cloud server using Rstudio 3.2.5. When I do I get this error:
Error: HTTP 400 POST https://api.shinyapps.io/v1/applications/ Validation Error
How do I resolve this?
install.packages('rsconnect')
library(rsconnect)
rsconnect::setAccountInfo(name='name', token='token'", secret="secret")
rsconnect::deployApp('C:/Users/path/of/R/app')
or
shinyapps::deployApp("C:\\Users\\path\\of\\R\\app")
This one was bugging me for a while today. Turns out the app name has criteria (these aren't mentioned if you just deploy via the button or command)...
App name needs to be minimum 4 characters with no spaces. Try a new name for the app and see if that works.
I was using more than 4 letter word for my app. But the issue was more due to firewall of my company I guess. I disconnected from VPN and tried deploying using public wireless and it worked.

Hosting a laravel project on openshift

I am pretty new to hosting on Openshift and also pretty new to Laravel.
I have a laravel project on my local system. What are the steps to successfully host the project on Openshift.
I tried the Quickstart guide, to load from a github repo. So i uploaded my project onto github
I had the env files kept secret by adding them in gitignore ( Should this be done ?)
I have the ssh key set up with rhv setup. Made a private key with Puttygen and can connect via Putty.
I checked if all the code has been uploaded to the openshift server with Putty
But my website gives a 500 Internal Server error.
What am i doing wrong ?
Edit: I connected to the server via ssh and found this error
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/lib/openshift/558bfb764382ec89c3000084/app-r oot/runtime/repo/public/index.php on line 50
Edit 2: On exploring the code on line 50 This is supported only on PHP5.5 or above. So i guess this is the problem ?
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
Is there any fix ?
How to fix this ?
You should try checking out the laravel 5 quickstart on the OpenShift Hub (https://hub.openshift.com/quickstarts/115-laravel-5-0), check out the source code and see what modifications were made to make it run correctly on OpenShift and then incorporate those changes into your application.