Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
how to generate oauth2 credentials after successful google login

i have successfully configured everything to work with google oauth2.

i have used

>django-rest-framework-social-oauth2


the user gets registered if new in DB, the user get logged in if old

everything working fine

i want to generate a oauth2 credentials if the user successful logged in using google oauth

like this

>{


>"access_token": "jCvkP4l7jt88D2O1H1WnNC5wx56knj",


>"expires_in": 36000,


>"token_type": "Bearer",


>"scope": "read write",


>"refresh_token": "u51zWkv056BNMsug8Qw6KCgk5Qtyp"


>}

/r/djangolearning
https://redd.it/88yf73
How do I run a flask app without a virtual environment?

I'm following a flask lesson, and they have me using a virtual environment.

I run the flask app by doing the following:

>(venv) set FLASK_APP=main.py

>(venv) flask run

but trying the same while outside of the venv I get "flask is not recognized as an internal or external command.

What am I missing?

/r/flask
https://redd.it/88v4jm
how to get access_token of google oauth user?

i have used django-rest-framework-social-oauth2

 

**added this to templates**

>'social_django.context_processors.backends',

>'social_django.context_processors.login_redirect',

 

**added backends**

>'social_core.backends.open_id.OpenIdAuth',

>'social_core.backends.google.GoogleOpenId',

>'social_core.backends.google.GoogleOAuth2',

 

**google keys**

>SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = "***"

>SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = "***"

 

setup everything on the https://console.developers.google.com

 

when i access this link http://localhost:8000/auth/login/google-oauth2/ from browser

 

everything working fine my logged user details are register in DB if new, else login if old. then the social auth auto redirects to this link http://localhost:8000/accounts/profile/# which is empty.

 

i need the access token of the google user so that i can convert the token to oauth token in this link http://localhost:8000/auth/convert-token with my site client id & secret i created.

 

after that i can use the converted token to grant access to my API request

/r/django
https://redd.it/88xvk6
Django Deployment: Where did the Training Wheels Go?

I have been learning django, and I wanted to "deploy" the resume website I have been building to learn django.

Django documentation is clear and concise, and it never takes more than a little google-fu to figure out how to build my project, but there seems to be FAR LESS information about deploying a project.

How do I get this thing online? Do you have a tutorial that helped you?

/r/django
https://redd.it/88zrjv
Procedural dungeon generation in Python

If you are interested in procedural dungeon generation, [here](http://arcade.academy/examples/index.html#procedural-generation) are few examples written in Python.

* [Recursive division maze-generation](http://arcade.academy/examples/maze_recursive.html)
* [Depth first maze-generation](http://arcade.academy/examples/maze_depth_first.html)
* [Procedural Caves - Cellular Automata](http://arcade.academy/examples/procedural_caves_cellular.html)
* [Procedural Caves - Binary Space Partitioning](http://arcade.academy/examples/procedural_caves_bsp.html)

Visualized using the Arcade library, but the maps are generated with a 2D array first, so it should be easy to visualize them using any system.

/r/Python
https://redd.it/88zans
[D] Why do people publish to paywalled publications?

Seems like a way to reach half the audience with little benefit.

/r/MachineLearning
https://redd.it/88zuk5
w/code: How does visualization in Plotly differ from Seaborn
https://datascienceplus.com/how-does-visualization-in-plotly-differ-from-seaborn/

/r/Python
https://redd.it/896hwz
Non Model serializer in Django restframework

Hello guys!
I am new to restframework in Django. I can make a model serializer such as for user and then create a ListAPIview for it. Its all fine. But is it possible to create api end point for data that is not a model in database such as doing some data analytics on the model and returning normal python dictionary data?

/r/django
https://redd.it/88zpwt
Checking to see if image field has validation errors

Does anyone happen to know how to check an image field within forms.py to see if it has on or more ValidationErrors on it?

Thanks!

/r/django
https://redd.it/897eiu
[ADVICE] Resources to Build Netflix Clone

Yep, that ain't easy. But can someone please share some resources to learn and build one.

Thank you.


/r/django
https://redd.it/88yc0a
Django noob. Looking to hire someone to help me with questions.

Hi everyone,

As the name suggests, I'm fairly new to django. I'm looking to hire someone who is experienced with django to help me with the odd question. I'm not sure what the pay structure would be (by hour, by question, etc.), but I'm sure that we'd be able to agree on something. Pay would be by Paypal and I can pay 50% upfront for the first few questions until trust is established.

If you're experienced with django and feel like making some side money for answering what might be relatively straight forward questions (to someone who is experienced with django), feel free to send me a private message.

If this isn't the place for this, do you know what site I should go to in order to find help?

Thanks!

/r/django
https://redd.it/899yuu