It is really weird that after clicking run button, it does nothing and also no log and show a clock sign on the first column.
It works normally before. However, after I messed up my python environment, the google coursebuilder can't run web application. That's my guessing. When I run which python.it only shows:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
These let me feel like I have no way to solve it!Are there anyone who came across this problem before? Any ideas or suggestions?
Updated: I follow suggestions to use command line to run web application on GAE. It reminds me here:
Update: The error message shows that GAE can't get the allocated port and domain. The reason why it happens is that when I use command line to run the web application, I also open GAE GUI to run a web app with the same port number.
So the way to solve it is to close the GAE GUI and free the port. Or we also could designate another kind of port number with command line.(--port=XXXX and --admin_port=YYYY). Or take a look at the doc:
Again thanks for the help of Mihail R!
The OP had multiple issues with GAE setup which were resolved by simply reinstalling the GAE Launcher and making sure the app was first copied into Applications from the .dmg file, then ran from the Applications instead of from inside the .dmg file, and appropriate permissions were suppose to be given so that GAE Launcher created the symlinks it needed to work properly.
More instructions on proper GAE SDK installation can be found here: https://cloud.google.com/appengine/downloads after clicking on the needed SDK and then the OS the SDK will be installed on.
Related
I've developed an ASP.NET website on IIS (virtual Windows Server using Amazon Lightsail) which works as expected for the most part. But one issue with it is with running specialized Python scripts.
In my website, there is a feature where a user (of a certain account level) can upload an image, which is then passed through Python (through Process.Start). After Python does its thing, it sends text output back to the webpage. This works perfectly under the context of IIS Express in my local computer, but on the server, it seems to not run Python at all.
It is noted that I did not receive any warnings or errors. Seems to entirely skip the Process.Start segment.
I suspect that it is due to either of these:
Security access
The application pool
The Process.Start function
Things I tried:
Changing the security settings of the folder with the Python app and the scripts, as well as the Python executable
Changing the application pool of the website to LocalSystem
Disabled dynamic compression
Added a script map for the Python app
Reinstalled Python from Users/Administrator/Local/Appdata... to C:/Python (also changed the required paths in the website code behind) I also made sure that I installed the right Python libraries for the code to work.
Apart from the file paths in the code behind, nothing is changed in the actual ASP.NET website and DLL. Ideally I should not need to change anything else with regards to the website.
The website still does not call Python. I've been scratching my head for the past two days on this single issue.
Also, the folder where the Python scripts and related files are located are within wwwroot.
Any suggestions are much appreciated.
TL;DR: ASP.NET website that calls Python to run an already-coded script as part of its function works great under IIS Express. Python does not run when called under IIS Server.
Need advice on how to incorporate Python into an Azure ASP.NET web application environment. Please excuse this question but I am new to Azure and I'm not clear on how to proceed. Every option that I look into looks promising but they all seem to have their own issues. Below is a more thorough explanation but the deal is that I have an Azure account with all kinds of goodies, a full fledged ASP.NET (C#) web app running via App Service, I am new to Azure (but not Python), and I'm hoping to add Python functionality to this whole setup. In short:
I want to add Python to this setup mainly to run scheduled jobs and also to trigger Python code from ASP.NET web form submissions
ideally I want a solution that resembles a non-cloud setup. I know this sounds silly but I'm finding the cloud/Azure functionality to be nuanced and not straightforward. I want a place to put a bunch of Python scripts, run, edit, schedule and trigger them from ASP.NET
for example: I created a WebJob that runs manually and from the documentation it wasn't clear how it should be called. I just figured out that you need to POST with Basic Auth (and the credentials provided).
!Also, Azure CMD does NOT like files with 'underscore _' in them! You cannot submit a Web Job with a py file with an underscore nor can you write output with a file with an underscore
!Also, I don't see an option for this Web Job to run Python 3.6.4 (which I installed via extension). Right now it is using 2.7.15...
!Also, CRON expression in Azure has six *, not five plus a command. Again, more weird stuff to worry about
I tried these instructions but the updates to the web page's Web.config file breaks the ASP.NET web pages
ideally the most cost effective option
Any info is greatly appreciated
MORE DETAILED EXPLANATION
Currently I have an ASP.NET site running via Azure App Service and I would like to add Python scripts and possibly Flask/Rest functionality. Note that I am not expecting to serve any content via Python and will largely be running Python scripts either on a scheduled basis or call them from ASP.NET. As a matter of fact, and this is an important point, I'm hoping to have ASP.NET trigger/run a Python script when a web form is submitted. I realize that I could get a similar effect if I make a web call to a Rest api that is running Python. In any event, I can't tell if I should:
add a Python extension to the current App Service running the web page (I tried this) OR
I did install Python 3.6.4 and some packages via pip
These instructions were useful, however the updates to the web page's Web.config file breaks the ASP.NET web pages
set up a VM that will have all of the Python code (but how can I have the .NET web page(s) call the Python in the VM?) OR
use Azure functions (I'm completely new to this and must admit that I prefer to have my old school Python environment instead although I see the benefit of using functions. But how do you deal with logging and debugging?)
or what about a custom windows container (Docker)?
This requires installing VS Code and that is OK but I'm looking for a solution that another user can get into with as few interruptions as possible
The idea is to ramp up the use of Python although, like I said, I don't expect Python to be serving any of the web content. It will be used to run in the background and to run scheduled jobs. What is the most robust and hopefully easiest way to add Python functionality to Azure (most importantly in a way to be able to trigger/use Python from an App Service running .NET?)? I've searched online and stack overflow so far with interesting finds but nothing to my liking.
For example, the following link discusses how to schedule WebJobs. I just created a manual one and when I called the webhook I got the message: "No route registered for '/api/triggeredwebjobs/TestPython/run'" How to schedule python web jobs on azure
The Docker method looks very promising, however, I'm looking for a simple solution as there is another person who will be involved in all of this and he's busy with other projects
Thank you very much!
I found a solution, though I'm open to more info. Like I mentioned in my post, I used the 'add extension' tool to add Python 3.6.4 to my Azure (installed in D:\home\python364x64).
Then I installed a bunch of packages via pip, these installed into D:\home\python364x64\Lib\site-packages.
I created a Python folder in webpages\Python where I put my scripts.
Finally, in ASP.NET I used the Diagnostics.Process call to run my code in ~\webpages\Python\somecode_2.py
The main issue is that Azure came with Python 2.7.15 installed. And for some reason when my Python code got executed it was using 3.4 (where that version came from beats me). So for each script, I had to create an _2.py version where I simply did the following in order to call the original script via Python 3.6.4. Looks a little nasty but it works. So like I said, I would welcome more info for ways to do this better...
--
import os<br>
os.system("D:\\home\python364x64\python.exe SomePython.py {0}".format(add arguments here)
I am trying to implement web2py in EC2. I followed simple official guide but its not working for me. These are the steps I've followed just now and I can't open it in my local browser. Objective here is to access site from EC2 deployment to server locally on my home computer. Can someone please point me to right direction? Thanks
In your Web2Py folder there is '/scripts' and it helps you to deploy web2py from scratch automatically. You don't need to do any research, just run one of the script according to the type of your machine you are using on EC2. Coz there are different scripts as per OS. Run the shell script with root and that's it. You can access your site at ip:8000 by default. You can change the .sh or script file if you need to use some other port for deployment in test phase. #Tarun it doesn't hurt to click on a link and I am doing this all the time when coders paste gist around.
I had a Django project that uses python 3.2+. Having been through a couple Azure classes I wanted to deploy my Django application through Windows Azure. I got the web site synced through my Git Repository, and following the advice of the MSDN forums, added the python 33 runtime in a folder called /PythonCore/ and added WSCGI.py to the scripts folder within there.
My website can''t find the CGI interface and likewise is failing to process HTTP requests. I know something must be wrong in my configuration, but I havn't a clue as to what. I was wondering if anyone might know what my error is.
WEBSITE_NODE_DEFAULT_VERSION 0.10.5
DJANGO_SETTINGS_MODULE DjangoApplication.settings
PYTHONPATH D:\home\site\wwwroot\DjangoApplication;
WSGI_HANDLER django.core.handlers.wsgi.WSGIHandler
Handler Mappings
* D:\home\site\wwwroot\PythonCore\python.exe D:\home\site\wwwroot\PythonCore\scripts\wfastcgi.py
Please let me know if any additional information is needed or you have an idea what I can try.
Azure Web Sites w Django currently requires Python version 2.7. Please see this:
http://www.windowsazure.com/en-us/develop/python/tutorials/web-app-with-django-and-mysql/
and
http://pytools.codeplex.com/wikipage?title=Django%20Web%20Site/Cloud%20Service%20Tutorial
Corresponding video walk thru:
http://www.youtube.com/watch?v=S7A7VNnsA_8
Python 3.x will be supported soon (hopefully fall 2013).
Ok, so I made this application in Bottle that uses the NLTK package. It works fine on my computer which has all neccesary libraries installed, however, I can't get it to work on Google's App Engine. It gives these errors:
AttributeError: 'module' object has no attribute 'getuid'
I searched around and think this is a limitation of GAE, so I tried to use Alwaysdata and host my app there. However over there I have the problem that the YAML module is not installed. I tried to install it but access was denied.
creating /usr/local/lib/python2.6/site-packages/yaml
error: could not create '/usr/local/lib/python2.6/site-packages/yaml': Permission denied
So now I am stuck. This is the problem I walk into a lot. It all works fine on my computer, but then I can't get it to work online. Is this because of GAE limitations, alwaysdata limitations? So I guess I am asking where and how could I deploy best?
Is it more easy when I rent my own server and have full access there? Does that work as if it were my own computer and I can install everything?
Let me know if I need to provide more information, I'm pretty clueless.
I realise that you've already found an answer, but for other people looking for Python bottle hosting. PythonAnywhere has a quickstart option for deploying and hosting bottle apps now.
This is a three or four click wizard process that will have a barebones bottle application running in a 10 seconds. Letting you then build from there.
I've had great success running all different types of Python frameworks on WebFaction - http://www.webfaction.com/
Their support is awesome, instant replies to any problems I face. You get SSH access and can install your own modules, virtual-envs etc. You can run sites as a Custom Application listening on a port number, so you can basically run anything.
Here's a thread on how to setup a Bottle app with them: http://community.webfaction.com/questions/3998/how-to-setup-a-python-bottle-application
All that for $8.50/month if you pay a year upfront. http://www.webfaction.com/services/hosting
I can't recommend them enough.
Edit: Thought it wise to mention, I've written apps that use the NLTK and they've run on WebFaction with no troubles.