i'm using the PyCharm IDE, and I am trying to import webapp2 from the google app engine SDK. Since the module does not come with python, it doesn't recognize it "No module named webapp2".. I am using the pycharm community version, is there anyway around this? can I import the SDK somehow?
PyCharm Community Edition can be configured to work with Google App Engine python and hence webapp2. You won't get all the advantages of PyCharm Professional Edition such as deployment, but you'll be able to do step by step debugging and get code navigation and auto-completion working.
To enable debugging, edit the PyCharm Run/Debug configuration by setting:
Script: App Engine's dev_appserver.py
Script parameters: --automatic_restart=no --max_module_instances="default:1" .
Working directory: your base project folder (the one which contains the app.yaml file)
For more detailed instructions, explanations, and how get code completion working in your PyCharm CE project, see this tutorial.
PyCharm Community Edition does not have support for Google App Engine.
Reference: PyCharm Editions Comparison
Here's the guide which can help you to install webapp2: Quick start (to use webapp2 outside of App Engine)
Note: webapp2 is just the first step, and you will miss PyCharm integration with Google App Engine. If your project requires other Google App Engine services, consider investment into Professional version of PyCharm.
I'm using PyCharm (webApp2 library) with google app engine and I tried to found the best way for debug by python code,
that's what I found:
There is two main options:
PDB (python debugger) - GAE tool for run & debug your code which is default installed in your GAE directory (dev_appserver.py).
The tool allows you to run your program from cmd and debug it manually.
"import pdb" to your python code
use the "pdb.set_trace()" command for put a breakpoint
use cmd to run the program cd <google_appengine_dir>
python dev_appserver.py <your_project_path>
for ins cd C:\Program Files (x86)\Google\google_appengine
python dev_appserver.py C:\projects\myapp
[pbd syntax][1]
insert pdb to your python code
The second and the my preferred option is to use the pycharm build-in debugger tool. All you need to do is to use the script dev_appserver.py in the pycharm debug configuration.
Configure python GAE debugging
If you consider to upgrade to a professional version of PyCharm (or use the 30 days test-license) you can find here a guide for PyCharm showing how to create a google app engine project:
Getting Started with PyCharm as Google App Engine IDE
Before your can create the project you have to download and install the google app engine sdk depending on your platform and which language you want to use:
Download the Google App Engine SDK
Related
I deployed my Python Django project to Azure Web Service Linux environment, and found an error most likely caused by the version of Azure's own Python version (see this post Azure Text to Speech Error: 0x38 (SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) when deploying to Azure App Services Linux environment ). However, I cannot seem to find a way to upload my own Python package (3.10) to Azure Web Service Kudu site. Is there a way to do it?
Thanks.
Currently, This is not possible, the latest python runtime available in the Linux web app is 3.9
and in the other question, The default Linux Kudu page has a minimum number of features available when compared to windows and so you cannot directly drag and drop your zip file. If you need to install more components or language runtimes, you just need to use Kudu SSH terminal using apt-get install <packages>.
Also, try checking Configure a Linux Python app for Azure App Service
Python 3.10 is now supported on App Service, so for this particular problem, you can update the configuration to Python 3.10.
We've recently moved from App Service to App Service Environment on Azure. We need Python 3.6 to run the web API. But we're not able to install the extensions. Are extensions disabled on App service environment. Azure by default offers Python 3.4.1. But few of the libraries need a minimum of 3.6.4 which is available as a extensions. Is there a workaround for this or are we limited to the default Python 3.4.1 available with Azure ?
In case you haven't seen already, see article
https://blogs.msdn.microsoft.com/pythonengineering/2016/08/04/upgrading-python-on-azure-app-service/
Microsoft says you can run newer versions, 3.4 is default purely to prevent breaking compatibility with existing sites.
Azure menu layout sometimes (annoyingly) changes from guides, but I was able to find it searching "Extensions" in the Menu for my App Service
This is indeed possible but took a bit of experimenting. I had to open the Kudu console from a VM which is inside the same VNet as the App Service Environment. From there on, it's a cake walk. You can also configure Web Jobs from the VM which is otherwise not possible from the portal.
I want to create a google app engine project in pycharm. I select python 3, give my project a name.
And it's written that App Engine is not supported for the selected interpreter
I can choose python 2.7 and it is working but why can't I choose python 3.6? I even tried 3.5, same problem. However in official documentation it supports python 3.6...
I'm sure I have installed google app flexible environment
I'll leave there a screen of pycharm just in case gdrive link
AFAIK PyCharm's GAE support means:
ability to run/debug a GAE app project using the SDK's dev_appserver.py - which is only supported for the standard environment
ability to deploy on GAE using the SDK utilities - which not long ago didn't even support well apps with multiple standard environment services - I had to deploy my app manually.
In other words PyCharm doesn't offer real/significant benefits for the flexible env GAE apps, you'll have to complement it with manual ops or scripts anyways.
So I'd just create a regular python 3.5/3.6 project and simply not specify it's also a GAE project.
I've made a simple app with Django in Visual Studio 2017, utilizing the default template in Visual Studio (file - new - project - python - django web application).
The app runs properly locally, but after i deploy it to Azure via Visual Studio, i can only access the page that shows:
Your App Service app has been created.
The files are all properly uploaded (i can see them in the 'site\wwwroot' folder), but the app doesn't work!
I have tried every thing that i was able to find in my searches such as: following this tutorial; adding '.azurewebsites.net' to the allowed hosts, installing azure sdk in my project virtual environment via: 'pip install azure', adding 'manage.py' to default documents, among many other things.
The thing is when i deploy (in the exact same way: right click the project, select publish, azure...) my ASP.NET apps to Azure, they work properly with minimum effort.
I am very frustated, because i really like Django framework and Azure, please help.
Thanks in advance!
In consideration of using Visual Studio to create & deploy a Django App for Azure, I suggest that you can follow the Azure offical tutorial Django and MySQL on Azure with Python Tools 2.2 for Visual Studio to inspect & make sure your steps correctly.
There are some checkpoints as below.
Make sure PTVS installed correctly, please move to here to know more details of PTVS.
Create a virtual environment for a Python version like 2.7 via PTVS.
Edit the requirements.txt file of your project, and make sure there is a record for Django like Django==1.11.2.
When you want to deploy it to Azure WebApps, please check the Python version for Azure WebApps that is the same with your project.
If your Django App doesn't still work as you want, please refer to the document to check the configuration of the web.config file via access the Kudu tool https://<your app name>.scm.azurewebsites.net and other troubleshooting content, and refer to the document to check the application settings on Azure portal.
Hope it helps. Any concern, please feel free to let me know.
After much struggle i manage to to do it!
I will explain how i did it (i've used many tutorials and forum posts answers to achieve this):
1) I've created a Django (PTVS) Web App in Azure;
2) Followed this tutorial to configure that app;
3) Make the necessary adjustments to web.config file in my project, notably the path to the python version installed via extension;
4) Published my project via Visual Studio 2017 to that Django App created in the first step.
And it worked!
I normally use Java development and the Google Eclipse plugin, which integrates GoogleAppEngine deploy capability.
Now I have found a Python application with source code that I want to bring into Eclipse and deploy from Eclipse, but I don't even know if Eclipse supports Python.
What do I have to do to deploy the Python app to GAE ?
Download PyDev from its Eclipse update site.
Create a new PyDev Google App Engine Project, say using the 'Hello webapp world' template.
Set the application in app.yaml to your GAE application ID.
Right-click the src folder of your project and select Run As | PyDev:Google App Run.
Test the application works as expected in your browser.
Right-click the src folder of your project and select PyDev:Google App Engine | Upload. Follow the prompts.
Check that it works on your GAE site.
Replace the hello webapp world code with your actual application's code and retest locally, then upload again and test.
Take a look at Pydev - http://pydev.org/
I haven't used python via Eclipse at all so I'm not sure how things map to the way Eclipse deploys, but generally to deploy all you need to do is this from the command line:
appcfg.py update <app directory>
You can find more help about using Python with appengine here:
http://code.google.com/appengine/docs/python/gettingstarted/