Comments (22)
I described a potential solution (enabling Cloud SQL Admin API) here: #129 (comment)
from getting-started-python.
I can confirm that pymysql is not supported in the python27 runtime. However, for most use cases, it's possible to use pymysql locally and mysqldb in production by using a try:
/ except ImportError:
to import one or the other conditionally. As they share the same interface, you can use import as
to make the two different libraries share the same name for ease of use in your code.
Django is a special case since the database driver is configured by the framework and not invoked directly. If you are using Django, you can put this at the top of your settings.py file:
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
from getting-started-python.
I have the same issue, following the steps here. The app runs fine locally, but gives the same error as mentioned when deployed. Are there any solutions?
from getting-started-python.
Hi, a few questions:
- Are you using Cloud SQL 2nd Generation?
- Did you uncomment this line in app.yaml?
- Can you double check these settings?
from getting-started-python.
- Yes
- Yes
- Yes - as noted, this works locally.
On Fri, Sep 30, 2016 at 9:58 AM, Jon Wayne Parrott <[email protected]
wrote:
Hi, a few questions:
- Are you using Cloud SQL 2nd Generation?
- Did you uncomment this line
https://github.com/GoogleCloudPlatform/getting-started-python/blob/master/2-structured-data/app.yaml#L33
in app.yaml?- Can you double check these settings
https://github.com/GoogleCloudPlatform/getting-started-python/blob/master/2-structured-data/config.py#L40
?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#92 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFmurWfoaVJiJjrxtn-69ZeXj7WLZvxsks5qvT--gaJpZM4KKvWx
.
from getting-started-python.
Thanks, I'll try to reproduce.
from getting-started-python.
Hrm, I wasn't able to reproduce. Can you paste in your config.py with your project id and password elided?
from getting-started-python.
config: http://pastebin.com/YVaxKeUg
app.yaml: http://pastebin.com/t1MjCD6e
On Fri, Sep 30, 2016 at 11:14 AM, Jon Wayne Parrott <
[email protected]> wrote:
Hrm, I wasn't able to reproduce. Can you paste in your config.py with your
project id and password elided?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#92 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFmurUNZ33QIM4yZBmnGHLYko7f58orqks5qvVGVgaJpZM4KKvWx
.
from getting-started-python.
@beshaya Hmmm, all of your configuration looks correct.
Can you check and make sure the Cloud SQL Admin API is enabled in the cloud console?
from getting-started-python.
I have the same problem than @beshaya!
works fine locally but when deply to GEA, Can't connect to MySQL server on 'localhost' raices.
(Cloud SQL is enabled admin API)
from getting-started-python.
This may just be an issue with the environment variable. I'm investigating.
from getting-started-python.
Hmm - the environment variable seems correct. I'm not sure why this is occurring and I can't seem to reproduce. Could you try printing the SQLALCHEMY_DATABASE_URI
at the end of config.py and seeing what it's pointing to in your logs?
from getting-started-python.
Hi John,
I've given up on CloudSQL and switched to Firebase. It's a better fit for
my application.
One thought - does it matter whether I'm using a standard or flexible app
engine instance?
On Mon, Oct 10, 2016 at 10:06 AM, Jon Wayne Parrott <
[email protected]> wrote:
Hmm - the environment variable seems correct. I'm not sure why this is
occurring and I can't seem to reproduce. Could you try printing the
SQLALCHEMY_DATABASE_URI at the end of config.py and seeing what it's
pointing to in your logs?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#92 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFmurZSe4weoaS7s4RUmkODlkY6nF_Vzks5qynCDgaJpZM4KKvWx
.
from getting-started-python.
@beshaya this application is intended for flexible. You can use Cloud SQL from both standard and flexible, but the configuration is slightly different between the two.
For Firebase, it shouldn't matter.
from getting-started-python.
Did anyone ever find a solution to this problem? I am facing it as well.
I have setup a MySQL Second Generation instance.
It is working when run locally.
Have the following flag in my .yaml:
beta_settings:
cloud_sql_instances: "datascrub-152522:us-central1:datascrub"
from getting-started-python.
@larsblumberg 's solution worked for me, enabling the administration api.
Can we also add this as a step to the tutorial here? https://cloud.google.com/python/getting-started/tutorial-app
Ideal would be to pass this solution in the error text, as app logs aren't visible by default from command line. Not sure how hard that is.
from getting-started-python.
@bwindsor22 the "Enable the APIs" button already ensures that the SQL Admin API is enabled.
from getting-started-python.
@jonparott, ah, I see
from getting-started-python.
this application is intended for flexible. You can use Cloud SQL from both standard and flexible, but the configuration is slightly different between the two.
@theacodes would you please elaborate on how configurations between the two differ?
context (maybe this part should be a separate question or stackoverflow post, so you can ignore if it's not relevant): I'm trying to work around this problem, none of the solutions here or in the linked issues have worked for me so far. I created a project for the Standard Environment following https://cloud.google.com/appengine/docs/standard/python/cloud-sql/using-cloud-sql-mysql#setting-up, but would like to use pymysql instead of MySQLdb because it has been a pain trying to install the latter on my system (macOS, using virtualenv). I would like to know if it is possible to use pymysql in a Standard Environment, and if so, how to set up the configs?
from getting-started-python.
@andrewsg should be able to help
from getting-started-python.
I'm not sure if it's true at all but so far from my experience and that of OP in this SO post it seems PyMySQL is not supported in the standard environment. @andrewsg can confirm? Or know an alternative? Still facing headaches installing MySQLdb on mac+virtualenv
from getting-started-python.
Good to know, @andrewsg. I finally managed to install MySQLdb locally after fighting for a few days with virtualenv. Issue was related to the DistutilsOptionError
discussed further in this Stack Overflow post
from getting-started-python.
Related Issues (20)
- 'from google.cloud import store' should be 'datastore' HOT 1
- Error: google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS HOT 2
- Cannot clone git synced repo from google cloud source repository HOT 1
- Folder column in the README is all 404's HOT 2
- bookshelf error on App Engine: "ImportError: cannot import name 'secure_filename' from 'werkzeug'" HOT 7
- testing: enable the Build Cop Bot HOT 1
- Cannot upload image HOT 1
- cleanup: snippet-bot full scan HOT 1
- Action Required: Fix Renovate Configuration
- Bookshelf requirements dependencies broken HOT 3
- 1-hello-world Directory won't exist HOT 3
- Conflicting dependencies in bookshelf app HOT 1
- issues following tutorial HOT 5
- Dependency Dashboard
- Add tests and automated CI HOT 3
- Update testing infrastructure to use Python 3.7 or higher
- Update the Ops Agent script via GitHub Workflow
- Update primary reviewer to python-samples-reviewers
- [email protected]/[email protected]
- Replace python-jose dependency HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from getting-started-python.