Giter Site home page Giter Site logo

Comments (22)

larsblumberg avatar larsblumberg commented on July 19, 2024 1

I described a potential solution (enabling Cloud SQL Admin API) here: #129 (comment)

from getting-started-python.

andrewsg avatar andrewsg commented on July 19, 2024 1

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.

onavsaber avatar onavsaber commented on July 19, 2024 1

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.

theacodes avatar theacodes commented on July 19, 2024

Hi, a few questions:

  1. Are you using Cloud SQL 2nd Generation?
  2. Did you uncomment this line in app.yaml?
  3. Can you double check these settings?

from getting-started-python.

beshaya avatar beshaya commented on July 19, 2024
  1. Yes
  2. Yes
  3. 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:

  1. Are you using Cloud SQL 2nd Generation?
  2. Did you uncomment this line
    https://github.com/GoogleCloudPlatform/getting-started-python/blob/master/2-structured-data/app.yaml#L33
    in app.yaml?
  3. 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.

theacodes avatar theacodes commented on July 19, 2024

Thanks, I'll try to reproduce.

from getting-started-python.

theacodes avatar theacodes commented on July 19, 2024

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.

beshaya avatar beshaya commented on July 19, 2024

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.

theacodes avatar theacodes commented on July 19, 2024

@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.

fermaf avatar fermaf commented on July 19, 2024

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.

theacodes avatar theacodes commented on July 19, 2024

This may just be an issue with the environment variable. I'm investigating.

from getting-started-python.

theacodes avatar theacodes commented on July 19, 2024

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.

beshaya avatar beshaya commented on July 19, 2024

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.

theacodes avatar theacodes commented on July 19, 2024

@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.

ajpharrington avatar ajpharrington commented on July 19, 2024

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.

bwindsor22 avatar bwindsor22 commented on July 19, 2024

@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.

theacodes avatar theacodes commented on July 19, 2024

@bwindsor22 the "Enable the APIs" button already ensures that the SQL Admin API is enabled.

from getting-started-python.

bwindsor22 avatar bwindsor22 commented on July 19, 2024

@jonparott, ah, I see

from getting-started-python.

kiptoomm avatar kiptoomm commented on July 19, 2024

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.

theacodes avatar theacodes commented on July 19, 2024

@andrewsg should be able to help

from getting-started-python.

kiptoomm avatar kiptoomm commented on July 19, 2024

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.

kiptoomm avatar kiptoomm commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.