Google cloud to run Python program as localhost server using Cloud SDK shell - sdk

Google cloud to run Python program as localhost server using Cloud SDK shell
Error in google cloud shell:
ymal file codes
runtime:python37
api_version:1
threadsafe:false
handlers;
- url:/
script:test.py
test.py file code
print("hello world")

App Engine is used to host web apps.
I encourage you to have a look at Google's quickstart for App Engine and deploying a "Hello World!" app.
Your Python print("hello world") while valid Python is not a web server and won't work as-is on App Engine.
Google's documentation is comprehensive and should help you get to a running app.
Please don't include images in Stack overflow questions because these have poor accessibility.

In addition to the comments from DazWilkin,
You are using dev_appserver.py which is a development server that simulates Google App Engine (GAE) in Production. Google now discourages using that, especially for the newer runtimes like Python3. Instead Google encourages you to ..run your application in your local environment with the development tools that you usually use...
Another possible way of learning to use GAE is to look at/tinker with the code of an App which runs on GAE. For example, you can use our App, NoCommandLine, which has a hello world App in different languages including Python
a) Follow all the steps documented by Google here to install or update the Google Cloud App Engine SDK. You need to follow all the steps so that all the files are installed/copied and the necessary shortcuts created.
b) Download and install the NoCommandLine App
c) Open the App, then go to File > New Application, give your app a name (Application ID), select Python 3 under Runtime and click the 'Create' button.
d) A new application will be created. Select the App, click the 'run' icon. It will open your default browser and display 'Hello World'.
e) You can now navigate to the directory for the App and open the different files to see the structure and code and you can play around with the code
Note that to deploy your App to production i.e GAE Production, you first need to create a Project with the same name as your App running on local host and you need to provide a credit card (Google will not charge your card but you must provide it)

Related

how to implement implement deferred deep linking in electron

Trying to find information on how to implement deferred deep linking in electron app but can't find it in the official electron documentation.
We have an electronic application. I need the following behavior: when a user tries to open a link of this type -> custom-protocol: // some-data in the browser, if the application is not installed, then automatically download the application and, after installation, pass the parameters contained in the link (some-data) to the application. Can anyone suggest how to implement this in electronic or a link to the documentation or show some abstract example of implementation
On Windows, custom protocols are stored in the registry. This is a chicken and egg problem because your application already has to be installed on the system for the registry entry to exist.
If you rewrite your application as a UWP app (lol) you might be able to check with getInstalledRelatedApps to see if the app is already installed.
If you want to streamline how your application is installed from the web, consider using ClickOnce.
So basically you just want a way to pass some query params to your application when installed from your website.
You can do this if you package your electron application as an MSIX. Check out the article below from Microsoft, that documents the process:
Passing query params to an MSIX packaged app

looking to run R GUI in R shiny server

Hope you all are doing good!
I am new to R shiny and no nothing about it(sorry) but i am trying my best to learn it. I have a R GUI ready with me which has all the widgets and buttons already, is there a way that i can host GUI in R shiny, if yes then can any one of you help me with that , My R file script name is NBAengine4.R. I really need your support here. thank you in advance!
Shiny is an R package that makes it easy to build interactive web applications (apps) straight from R. This lesson will get you started building Shiny apps right away.
If you still haven’t installed the Shiny package, open an R session, connect to the internet, and run
install.packages("shiny")
The Shiny package has eleven built-in examples that each demonstrate how Shiny works. Each example is a self-contained Shiny app.
The Hello Shiny example plots a histogram of R’s faithful dataset with a configurable number of bins. Users can change the number of bins with a slider bar, and the app will immediately respond to their input. You’ll use Hello Shiny to explore the structure of a Shiny app and to create your first app.
To run Hello Shiny, type:
library(shiny)
runExample("01_hello")
Structure of a Shiny App
Shiny apps are contained in a single script called app.R. The script app.R lives in a directory (for example, newdir/) and the app can be run with runApp("newdir").
app.R has three components:
1.) a user interface object
2.) a server function
3.) a call to the shinyApp function
The user interface (ui) object controls the layout and appearance of your app. The server function contains the instructions that your computer needs to build your app. Finally the shinyApp function creates Shiny app objects from an explicit UI/server pair.
One nice feature about single-file apps is that you can copy and paste the entire app into the R console, which makes it easy to quickly share code for others to experiment with. For example, if you copy and paste the code above into the R command line, it will start a Shiny app.
Running an App
Every Shiny app has the same structure: an app.R file that contains ui and server. You can create a Shiny app by making a new directory and saving an app.R file inside it. It is recommended that each app will live in its own unique directory.
You can run a Shiny app by giving the name of its directory to the function runApp. For example if your Shiny app is in a directory called my_app, run it with the following code:
library(shiny)
runApp("my_app")
Also go through this link for more info regarding shiny server,
https://shiny.rstudio.com/articles/shiny-server.html

Google App Engine: Load another Docker Image for Scrapy + Splash

I'd like to scrape a javascript website using Scrapy + Splash in Google App Engine. The Splash plugin is a Docker image. Is there any way to use this within Google App Engine? App Engine itself uses a Docker image, but I'm not sure how to load and access a secondary image (which is how Splash is used). Here are the Splash install instructions
You can use Custom Runtimes in the App Engine Flexible Environment.
Custom runtimes let you build apps that run in an environment
defined by a Dockerfile. By using a Dockerfile, you can use languages
and packages that are not part of the Google Cloud Platform and use
the same resources and tooling that are used in the App Engine
flexible environment.
Explore more About Custom Runtimes. Please note when you use a custom runtime, you have to write your application code to deal with some flexible environment life-cycle and health checking requests. Check how to build a custom runtime for more information.
Deploying the Splash service separately is the proper way to accomplish this.
I went ahead and tested a few different setups and the only approach that allowed me to have Splash on App Engine was to deploy it as a custom domain, setting the forwarded_ports to able to connect directly to one of the service’s instances through its IP address.
This is clearly not an adequate solution, as it comes with many limitations and, in the end, it becomes basically using Google Compute Engine without all the control it provides.
My suggestion is that you only deploy the Scrapy service of your application to App Engine, and leave the Splash service somewhere else, like in a GCE instance.
Once you have that, all you will need to do is set a static IP address for the instance and connect to it from your App Engine app through that.

What is the advantage of using angular with electronJS

I want to create desktop application compatible with other OS.For that I'm using electron with angular.Because both are frame work whether it will effect performance or loading time, and also whether deploying easy,can we use all the features of angular when we use with electron like routing..?
Electron uses Chromium and NodeJS which is the reason why it is compatible with other OSs. You can talk with the NodeJS process from your angular-app which opens up some possibilities. For example opening native file-dialogs to let the user choose files. Electron also already abstracts some platform specific operations like getting the user home to save some configuration files for example.
You can use routing just like in any Angular app and I think you can use most features like you would normally but dont take me for granted on this one.
I would not say it affects your loading time to combine those too. During development you have to build your angular app before electron can start up and use those files but in production Angular is already ready to be loaded so they dont hinder each other.

How do I demo an electron app on the web

Is there a way to easily distribute an electron.atom.io app as a static site?
I don't need all the functionality, I just want to allow the client to view the latest updates.
-- edit --
Perhaps a better way to ask the question is; "How do I build a web app that can be hosted online and run on electron with minimum rewriting" - similar to the Slack app that works the same way on web or electron app.
As long as your main use of Electron is to create a 'native browser wrapper' for a web-app this is entirely possible.
You will have to implement a check if your application is running inside a browser or inside Electron and wrap your electron specific code in it:
if (window && window.process && process.versions['electron']) {
const {BrowserWindow} = require('electron').remote
}
You'll probably have to step through your application and disable Electron specific functionality at multiple places.
You have other options to do a long distance demo of an Electron app
Electron is basically a shell to run node.js apps on the desktop. This means if you want to move it to the web, you have to give up all the Electron APIs that access the local system and you're left with a basic node.js app, which is most likely not desirable.
To demo your desktop app to an off-site client, you can either make a presentation with screenshots detailing the current user flow, or compile a sandboxed demo version of your app and send it over to them.
Screen presentation
This is your quickest and easiest solution if your client just wants to be kept in the loop and see some eye candy. You can just record how the app works with some example data, add some written or audio explanation to it, and let them enjoy the smooth ride.
Build a demo
If your client wants to actually have a hands-on demo with the app, you need to have some form of basic code distribution. The cleanest way to do this would be to tie up all loose ends in your current app flows, block all unfinished roads in it and compile it for whatever platform your client requested the demo for.
Take a look at the electron-packager and electron-builder docs to get an idea how to build an .exe, .dmg or whatever file from your Electron app, then send that file to them with some basic instructions.

Resources