Flask Dance timing out when deployed to Azure - python

It's me again. I have had more problems getting Flask to work with Azure Active Directory. I am almost there but I just cannot figure out how to get over this hurdle. If anyone can help me, I'd be forever grateful.
Here is what works so far:
Running my app on the local host with Flask Dance user authentication
Deploying my app to Azure without any user authentication in it.
Deploying my app to Azure using the Adal library for user authentication (problem is I want to use Flask Dance instead of Adal because of other features).
So if I run it locally, it works perfectly. If I comment out the few lines of code about Flask Dance in my app, it works perfectly as an Azure website. If I include those lines of code referencing Flask Dance and upload it to Azure, it builds successfully, but when I go to the website, it just stalls and nothing happens until it finally times out with a 500 error. So far Microsoft has not been able to help me either.
I run it just like this:
blueprint = make_azure_blueprint(
client_id="{client_id}",
client_secret="{client_secret}",
tenant="{tenant_name}"
)
app.register_blueprint(blueprint, url_prefix="/getAToken")
Then I have a small decorator function checking if the user is logged in that checks if the user is azure authorized and if not, redirects them to the azure login page. All of this works perfectly fine at the local host, so where is it going wrong?

Related

Setting up a sever on Google Cloud with Postgresql database?

I've been trying for about two weeks now to set up a server for a completed Django app on the google cloud shell. All of the documentation for gcloud is confusing and sends me to several different pages for one task and it is very hard to keep track of what to do. Sites like digitalocean, which is useful for Django program setup, doesn't work on gcloud. I haven't figured out a way to connect a postgres VM to my program through the cloud shell despite having the server running. I am very lost in setting this up. Could someone please help me set up my Django app? It runs perfectly on localhost but when trying to implement it into the google cloud nothing works.
I've done the django-gcloud tutorial already and set up a simple site just by importing the code from google, which doesn't help because all it does is import a completed app and you just type in "gcloud app deploy" which doesn't explain how to set it up so that you can do that.
My program uses python 3, DjangoRestFramework, and Celery. The database is Postgresql.
My full module list is:
Django-1.11.2 amqp-2.1.4 astroid-1.5.3 billiard-3.5.0.2 celery-4.0.2 djangorestframework-3.6.3 isort-4.2.15 kombu-4.0.2 lazy-object-proxy-1.3.1 mccabe-0.6.1 pep8-1.7.0 psycopg2-2.7.1 pylint-1.7.2 pytz-2017.2 six-1.10.0 vine-1.1.3 wrapt-1.10.10

Cannot access Google App Engine dashboard and upload Python app

This morning I made some changes to my Python web app, and then I uploaded my App using the tool provided by Google. But it stopped at "Compilation starting", and it showed error 500 after couple minutes. In the same time, I cannot access the dashboard of the app.
I have never faced this situation.
Did anyone experience the same situation? Or what might cause this situation?

Soundcloud redirect_uri_mismatch with Flask

I'm developing a webapp using Python Flask. Authentication is done using Soundcloud OAuth.
I developed everything locally and it worked fine.
I configured the Soundcloud app 'Redirect URI' to
http://localhost:5000/index
Then I wanted to deploy the app on a Digital Ocean virtual root server using Ubuntu 14.04 (as used for development).
And from then whichever 'Redirect URI' I provided it didn't work.
I used:
http://178.62.???.??:5000/index
http://178.62.???.??/index
Gives me:
http://178.62.???.???:5000/index?error=redirect_uri_mismatch&error_description=The+redirection+URI+provided+does+not+match+a+pre-registered+value.#
I have no clue how to get that running.
Anyone used Soundcloud OAuth with Flask and got it running?
Thanks for your help!

Can I connect to a GAE app from a Java ME application?

I just finished working on a GAE application in python to retrieve flight data and return the result to the calling URL.
I tested it in a browser at it works, but my Java ME application, which is able to retrieve data from other websites turns up nothing from the GAE app which is already hosted on GAE.
I know Google has some authentication issues, but does this apply to GAE apps as well, and what can I do?

Debugging server script like python?

I'm new to 'network' programming. I've done throughout the Google app engine tutorial and I'm trying to make my own application which is guestbook. It has a server script on Google app engine and client app is running on iPhone.
But how do I check if the server is received my message from iPhone?
or How do I debug the script I wrote on server side? (it's an python script)
I want to make sure the data is in right format and other stuff.
Please somebody give me a link if there's good tutorial or good place to start. thanks.
In your code you should be using tons of logging calls. In the app engine dashboard for your app there is an option to view logs, and all of your logging calls will show up in there (and can be filtered in various ways).
There are also ways to run dev_appserver.py and debug locally using software like PyDev, but you'd have to make your iPhone app send its messages to the address of your local server.

Categories