Django + GAE + Google Cloud SQL authentication issue in Windows - django

I've followed all steps required to configure Django with GAE + Google Cloud SQL (on Windows 7) but I am unable to authenticate (OAuth2) and run syncdb remotely. When I run manage.py syncdb the browser pops up and I am requested to allow access, but when I do that nothing happens. The browser is forwarded correctly to my local django instalation (the typical It worked! screen) but no OAuth2 token is in %USERPROFILE%\ and the console gets frozen:
C:\Users\me\myproject>python manage.py syncdb
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?state=None&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=my_id.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsqlservice&access_type=offline
If your browser is on a different machine then exit and re-run this
application with the command-line parameter
--noauth_local_webserver
There is no error message and I have to kill the console.
Anybody has faced a similar issue? Is there any log somewhere in GAE I can check?

I had the same problem, only on OS X.
I never figured out why, but it went away after a reboot.

I had the same issue, but it was because I had local appengine server running while I was running manage.py syncdb. Shutting it down and trying again worked as intended.
hope that helps.

Related

Server Error (500) Django App on AWS server

Good day,
i have currently my django project running on an aws server. I have used Nginx and configured it all. The application is running, but when i try to login via the login page i have created or try to login via the admin panel it gives me a Server Error (500). I have my DEBUG=False and added my server dns to ALLOWED_HOSTS. As for the Database. I have got my SQL Database running on an Azure server and used environment variables (that i have permanently set in my ubuntu terminal) to get my password and username.
I have also tried to set DEBUG to False and trying to figure out the issue when running python manage.py runserver so i could experiment with it on my localhost, but no luck. I cant access 127.0.0.1 eventhough i have added it to my Allowed hosts.
How could i see what the error is? Thank you in advance
Ok, so fixed it!
After each change, you simply run the command sudo supervisorctl reload in your powershell after you ssh'ed into your aws ec2 server.
As for seeing what the error is, simply set DEBUG=True

have no permission to access superset tables either from load_examples or added manually after installation

i have airbnb superset setup on centos 6.6 and python 3.4 virtual env. the web server is booted up without error logged and also OK to browse the web ui. but neither the tables which are already there due to"superset load_examples" in setupup, nor the mysql tables i managed to add in web ui by myself, are accessable from web ui. all tables are reported "The endpoint requires the datasource tablenamexxx, database or 'all datasource_access' permission", "You do not have permission to access the datasource(s):multiformat_time_series."
Anyone familiar with superset can help check this?
Error prompt is like this pic:
I have encountered this issue myself by neglecting to run the superset init command during the installation and initialization process before starting the webserver. Shutting down the webserver, running superset init, then restarting the webserver with superset runserver solved the issue for me.

Django manage.py commands with Google App Engine and Vagrant

I have a Google App Engine app and I'm running Windows with Vagrant. I have an Ubuntu installation which I access via vagrant ssh. On that machine I installed the Google App Engine SDK for Python and I can successfully deploy my app with:
appcfg.py update myapp --oauth2 --noauth_local_webserver
The --noauth_local_parameter allows me to copy the oauth URL and paste in the browser on my Windows machine, because on the Linux machine I have no GUI. Everything is working fine.
But now I want to use the Django manage.py syncdb command, to create the tables in Google Cloud SQL. The problem is, when I execute that command, the text-based w3n browser starts for the authorization, and then I get the error message that the browser does not support javascript.
I'd like to run the manage.py commands with the --noauth_local_webserver flag, but that is not supported by the manage.py commands. How can I solve this? I have already installed an Ubuntu virtual machine with GUI and given the app the permission and manage.py works fine on that machine, but when I try to execute the command on the Vagrant (non GUI) machine, it stills want to open the browser for permission.
Hm, I manually copied the oauth .dat file to the vagrant server, and manage.py syncdb is now working, but the website still can't connect in the browser; it says:
No valid OAuth 2.0 credentials. Before using the Google SQL Service backend on dev_appserver, you must first run "manage.py syncdb" and proceed through the given instructions to fetch an OAuth 2.0 token.
It seems to be the same errors as here. In my case it seemed that the necessary GOOGLE_SQL_OAUTH2_REFRESH_TOKEN environment variable was not set. I copied this refresh token from the .dat file and set it in the app.yaml:
env_variables:
GOOGLE_SQL_OAUTH2_REFRESH_TOKEN: "..."
Now everything is working fine.

Heroku app with Django and postgres crashing unexpectdly

I am new to Django development, but I am in a situation where I need to deploy a large project on Heroku.
I ran my app in local system, it worked fine.
I pushed the same to Heroku and it also worked fine. But after few hours I open my app URL in browser , then app is saying Some thing has broken,intimated to admin.
The app worked fine before few hours, but what happened after few hours.
I just pushed my old DB backup to Heroku DB, Thats it app running fine now.
But I confused what happened to my app, I am facing this problem again and again,
how can I avoid this problem in future.
My app configuration:
psycopg2==2.4.5
Django==1.4
This could be a number of causes. It sounds more like a database issue. I would run the following command
heroku pg # TAKE NOTE OF THE HEROKU_POSTGRESQL_[COLOR]_URL
heroku pg:reset HEROKU_POSTGRESQL_[COLOR]_URL --confirm [appname]
This will reset your postgres database that is the active one, remove all tables etc.
Then I would run the regular command to get your database backup and running.
manage.py syncdb
You can also do the following
manage.py validate
This will go through your modules and tell you if any errors are present.
If that fails - enable debug in your settings.py file.
Also you can run "heroku logs" this will tell you the last few errors and statuses that have been hit with your app.
Let me know if this works, if not I will help debug further.

django non-rel rollback

I cancelled a deployment to GAE while using django non-rel's manage.py deploy.
Now when I try to redeploy it says Another transaciton is already in progress and use appcfg to rollback.
But django non-rel doesn't have appcfg.py so how can I rollback or fix this issue?
I've scoured the internet and can't find any answers. I've waited about half an hour and it still displays this message.
manage.py deploy calls appcfg.py in order to deploy.
appcfg.py is in the SDK. you must have the SDK installed somewhere if "manage.py deploy" is working. you can look around for it, or download the SDK again.
There's no reason you don't have access to appcfg.py
If you need more help finding it, add details about what platform you're running on, where you installed the appengine SDK and where your python folder is.
What do you mean by "I don't have access to appcfg.py"?
Try going to cmd (for windows), navigate to your app directory, and type in the following:
appcfg.py rollback .
Hit return (enter key) and see if that works. If not, what does it display?