I am new to google app engine, I want to create a google app engine application.
I am following this blog.
I am trying it with step by step. I am stuck with its 2nd step, where I have created conf package and relatively settings.py. I am getting ImportError: No module named django.conf error. What I am doing wrong here?
the link you read is old and may out of date.
The following document may help you config your django on newest app engine python environment.
https://developers.google.com/appengine/docs/python/cloud-sql/django?hl=zh-tw
you may need add the following lines in your app.yaml first and see if it solve the ImportError
libraries:
- name: django
version: "1.4"
Related
I'm deployed an app to Google Cloud using this tutorial. The app is made using Flask and makes use of flask-sqlalchemy (and thus sqlalchemy).
I can load pages that don't make use of sqlalchemy fine, but pages that do raise a 500 error. The error page shows ImportError: No module named _sqlite3.
I suspect it has something to do with me trying to install a Python3 library to gcloud's Python2.7 environment, but I don't know how to fix this. Who can help me?
Have a look at Google's examples here for App Engine Standard, Cloud SQL and Python:
https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/cloud-sql
There's one for MySQL and another for PostgreSQL.
The tutorial link you shared does not appear to include a database component so I'm assuming you've evolved the example and that you're planning to use Google Cloud SQL database service for your backend.
You're likely missing a Python package that provides SQL connectivity (Google uses PyMySQL)
I'm getting the following error message when trying to deploy my Dash app to Azure:
Error
It then cleans up and says that "Command pyton setup.py egg_info failed with error code 1 in D:\home\site\wwwroot\env\build\Pandas"
What am I doing wrong here? Is there an issue with Pandas?
Funnily enough I ran into the exact same issue for a web app that I am working on at the moment. After 5 days of trying endless solutions I have eventually managed to get my app to deploy to Azure. My app is a Flask web app but the process is pretty much the same (if you are using Django or Dash in your case) or anything else. I am providing my answer based on the most useful links that solved my issue (I checked far too many, but these did the trick!).
This seems to be a known issue with Azure and is to do with Python version and package compatability. The first thing to check here will be the version of python you are using - if you have created your virtual environment in a version of python which is > 3.4 then you will need to install the Azure Python extension. This can be found on the left hand pane of your App Service resource under the category 'Development Tools' -> 'Extensions'. Currently the latest Python extension you can install is version 3.6.4. I had to install this as I was using python 3.6.5 for my web app:
I used the following answer by Konrad Lyda to help me solve my issue : Using python 3.6 on azure app services - not working despite it is installed as extension. You will have to manually install your packages using the kudu console and by adding a .skipPythonDeployment file. This is all explained in the link. I managed to replicate the same WSGI_HANDLER Error as highlighted and some further research led me to this link: https://github.com/Cojacfar/FlaskWeb . I know this link is Flask specific but the project structure should really help. You will need to add a web.config file to your project (just take the code from the web.config file in the git project) and replace the 'WSGI_HANDLER' value to the name of your app file. My app was defined in my views.py file so the value I used was 'views.app'.
The line that did it for me was:
wsgi_app = app.wsgi_app
which goes under your app declaration. For example, as I was using Flask and Flask boostrap I have the following in my app file:
app = Flask(__name__)
bootstrap = Bootstrap(app)
wsgi_app = app.wsgi_app
Once I got all my code in place I removed any unnecessary files that I did not need and deployed to Azure and it started working!
Let me know you get on. Hope this helps.
I have a django application that runs on Google App Engine. I use djangoappengine and django-nonrel and it works fine (with the complete source code of django in my App Engine project dir).
I've noticed that GAE offers support for django by adding the following lines to app.yaml:
libraries:
- name: django
version: 1.5
I would like to use it instead of putting the entire django-nonrel source code in my project dir.
When I remove django-nonrel from my project dir, I get the following ImportError from djangoappengine/boot.py:
ImportError: No module named django.conf
It looks like djangoappengine can't find any version of django - not the one installed on my python installation, and not the ones come with AppEngine.
How can I make the dev server use the AppEngine version of django?
Or am I missing something?
Update:
When I manually edit djangoappengine/boot.py and add
sys.path.append(r'<PATH TO GAE API>/google_appengine/lib/django-1.5')
It works. Any way to add to the path without editing djangoappengine?
The Django module included with the GAE SDK is "regular" Django, not django-nonrel. "regular" Django can only deal with SQL databases, it can't deal with GAE's datastore.
If you're using CloudSQL, use "regular" Django. If you're using the HRD datastore, use django-nonrel.
The error you're seeing is because djangoappengine (and djangotoolbox) only work with django-nonrel. They won't work with "regular" django.
I am developing my application in google app engine now i am using Google Cloud SQL. It runs at localhost perfectly,, But when i am deploying my application to server it gives me following error.
ImportError: No module named MySQLdb
Later i have copied MySQLdb package to application directory. Now it is giving me error
ImportError: No module named _mysql.
What i am doing wrong here , Any guideline ?
MySQLdb might be missing in your app.yaml. This library should be there so that Google App Engine loads it for your instance. Hope this will help.
libraries:
- name: MySQLdb
version: "latest"
Looking at the docs that does not seem to be how you do it at all.
Building an application with a local MySQL instance
from google.appengine.api import rdbms
CLOUDSQL_INSTANCE = ''
DATABASE_NAME = 'guestbook'
USER_NAME = 'username'
PASSWORD = 'password'
def get_connection():
return rdbms.connect(instance=CLOUDSQL_INSTANCE, database=DATABASE_NAME,
user=USER_NAME, password=PASSWORD, charset='utf8')
This tutorial got my app eventually working...
What I did: I created a very basic project (just one simple app with one model) and followed above tutorial to get it working in my development environment and on GAE. Then migrated my code from my old (non-GAE) project to the new project. All was fine.
The bad news: it still takes some effort getting a new project properly deployed on GAE and Cloud SQL. I have never managed to get it working in one go. You have to really scrutinise the GAE logs.
I'm getting this error when I attempt to deploy my python project for the first time. I could have sworn that I set everything up correctly. Is there something I need to set in the configuration? I have not idea where to start looking, any help would be appreciated.
This is my app.yaml file. It resides in the src folder:
application: bsl-dm
version: 1
runtime: python
api_version: 1
EDIT: After looking into this, I think the solution is that you cannot do this for python through eclipse (only java). You instead have to use the separate "Google App Engine Launcher" application.
I got your problem. I think you are using google plugin to deploy the app which expects an java application. It won't work for python applications. To deploy python app engine app from eclipse use pydev plugin. A search on google will get you there
This got me too! I assumed the button in the toolbar could be used for Python too but it was only for java.
In eclipse(which im guessing its the same in Aptana) once you have the pydev plugin installed simply right click on your apps main folder and go to "PyDev: Google App Engine" and click 'Upload'
You have a register a unique application id in appengine.google.com for your account inorder to deploy the same.You will see something like this where you have to choose a id and register it. Make sure you have mentioned the same in your app.yaml.
Have you reserved that app-id at https://appengine.google.com/ ?