A simple URL shortener using Flask (website in comments)
https://www.youtube.com/watch?v=YI16KWyA3M0
/r/flask
https://redd.it/iy5ocv
https://www.youtube.com/watch?v=YI16KWyA3M0
/r/flask
https://redd.it/iy5ocv
YouTube
URL Shortener using Python + Flask (explained beginner project)
In this video we are going to be building a simple URL shortener using Python and Flask. The process is fully explained and makes for a great way to learn flask. I tried to simplify the project as much as possible in order to make it beginner friendly.
…
…
[D] Snapchat Anime Filter
If you don't know what I'm talking about, take a look [here](https://comicbook.com/anime/news/snapchat-anime-filter-viral-manga-2020/#10).
As soon as I saw how stable the generation of the filter was, I started experimenting with it and trying to figure out how they did it.
My current belief is as follows. They manually hooked up the features from their face detection/recognition algo into an anime face GAN. So you can think of as those sliders that control age/hair colour/skin colour on the face generation website but hooked up to features from facial recognition.
SC definitely has singled out which algo features correspond to which facial features because they use hair colour/length in other filters.
This approach leads to the more generic anime faces seen in the filter, but is way more stable than something like https://selfie2anime.com/ that does image-to-image conversion.
Aside from that, the filter just does a simple posterisation and overlays the face in the right spot.
Thoughts?
/r/MachineLearning
https://redd.it/iy8njt
If you don't know what I'm talking about, take a look [here](https://comicbook.com/anime/news/snapchat-anime-filter-viral-manga-2020/#10).
As soon as I saw how stable the generation of the filter was, I started experimenting with it and trying to figure out how they did it.
My current belief is as follows. They manually hooked up the features from their face detection/recognition algo into an anime face GAN. So you can think of as those sliders that control age/hair colour/skin colour on the face generation website but hooked up to features from facial recognition.
SC definitely has singled out which algo features correspond to which facial features because they use hair colour/length in other filters.
This approach leads to the more generic anime faces seen in the filter, but is way more stable than something like https://selfie2anime.com/ that does image-to-image conversion.
Aside from that, the filter just does a simple posterisation and overlays the face in the right spot.
Thoughts?
/r/MachineLearning
https://redd.it/iy8njt
Comicbook.com
Snapchat's Anime Filter Is Going Viral for the Right Reasons
Snapchat is one of the top social media apps out there, and it brings in millions of users daily [...]
Python 3.9 will remove backwards compatibility layers for Python 2.7
https://docs.python.org/3.9/whatsnew/3.9.html#you-should-check-for-deprecationwarning-in-your-code
/r/Python
https://redd.it/iydze3
https://docs.python.org/3.9/whatsnew/3.9.html#you-should-check-for-deprecationwarning-in-your-code
/r/Python
https://redd.it/iydze3
reddit
Python 3.9 will remove backwards compatibility layers for Python 2.7
Posted in r/Python by u/pimterry • 200 points and 41 comments
Implementing social authentication for Django web application??
Hello everyone, I can't for the life of me figure this out.
I am creating a web application that will use private Yahoo! API's.
From this, I would like to have a log in button for Yahoo!, that will authenticate the user using Yahoo! OAuth2. Once authenticated, I want to retrieve the access_token so that I can make API requests for the given user...
I have exhausted many pages of google tutorials, I can't figure this out...
This website here does exactly what I want to do: https://yfantasysandbox.herokuapp.com/
Where the user simply logs in through Yahoo! and I can store their token to make future API requests...
Can anyone point me in the right direction regarding this???
/r/django
https://redd.it/iyhmaz
Hello everyone, I can't for the life of me figure this out.
I am creating a web application that will use private Yahoo! API's.
From this, I would like to have a log in button for Yahoo!, that will authenticate the user using Yahoo! OAuth2. Once authenticated, I want to retrieve the access_token so that I can make API requests for the given user...
I have exhausted many pages of google tutorials, I can't figure this out...
This website here does exactly what I want to do: https://yfantasysandbox.herokuapp.com/
Where the user simply logs in through Yahoo! and I can store their token to make future API requests...
Can anyone point me in the right direction regarding this???
/r/django
https://redd.it/iyhmaz
reddit
Implementing social authentication for Django web application??
Hello everyone, I can't for the life of me figure this out. I am creating a web application that will use private Yahoo! API's. From this, I...
Need help to find ways to generate reports
I'm building an app using Django. In this app, I would like to generate pdf reports using weasyprint package.
In my app, I have views to get data from my models and process this data (I do this by calling functions that I wrote in a separate module) then pass it to the templates to display it.
In these templates, I have a button to download the pdf report, when clicking this button it will redo (re-call functions from the module) which some functions take time (in case of year report) to return the result.
I would like to know if there are other ways to generate the report without recalling these functions?
And how about sending the result data from templates using AJAX to the view that generates the pdf report? This is a right way? There are other ways?
Below views that I use to display the day and last year stats (the first and second one) and to generate pdf (the third).
def day_period_stats(request, period):
day = timezone.now() if period == 'today' else timezone.now().date() - timedelta(1)
result = get_tasks_info_of_day(day)
return render(request,
/r/django
https://redd.it/iyhls5
I'm building an app using Django. In this app, I would like to generate pdf reports using weasyprint package.
In my app, I have views to get data from my models and process this data (I do this by calling functions that I wrote in a separate module) then pass it to the templates to display it.
In these templates, I have a button to download the pdf report, when clicking this button it will redo (re-call functions from the module) which some functions take time (in case of year report) to return the result.
I would like to know if there are other ways to generate the report without recalling these functions?
And how about sending the result data from templates using AJAX to the view that generates the pdf report? This is a right way? There are other ways?
Below views that I use to display the day and last year stats (the first and second one) and to generate pdf (the third).
def day_period_stats(request, period):
day = timezone.now() if period == 'today' else timezone.now().date() - timedelta(1)
result = get_tasks_info_of_day(day)
return render(request,
/r/django
https://redd.it/iyhls5
reddit
Need help to find ways to generate reports
I'm building an app using Django. In this app, I would like to generate pdf reports using weasyprint package. In my app, I have views to get data...
Thursday megathread: Python careers!
Discussion of using Python in a professional environment, getting jobs in Python and more!
**This thread is not for recruitment, please see** r/PythonJobs **or the thread in the sidebar for that.**
/r/Python
https://redd.it/iymd26
Discussion of using Python in a professional environment, getting jobs in Python and more!
**This thread is not for recruitment, please see** r/PythonJobs **or the thread in the sidebar for that.**
/r/Python
https://redd.it/iymd26
reddit
Thursday megathread: Python careers!
Discussion of using Python in a professional environment, getting jobs in Python and more! **This thread is not for recruitment, please see**...
2-years in the making! Codename Mallow is a 4 player local/online versus multiplayer that I've been coding entirely in Python/Pygame. Tackled rope physics, particle engines, and other fun things. The demo launched today!! The source code is available, too. Enjoy :)
Codename Mallow is an adrenaline-charged versus multiplayer game with armless melee battles, one-hit-kill weaponry, and wildly unpredictable stages. Duel for Ninja Supremacy with up to 4 friends in local or online play. Demo & Source Code available NOW!
https://reddit.com/link/iy9cx3/video/4jktd5jy7wo51/player
Demo / Code: [https://ancalabro.itch.io/codename-mallow](https://ancalabro.itch.io/codename-mallow/)
Website: [https://www.codenamemallow.com](https://www.codenamemallow.com/)
To anyone perusing the source code, be warned: I am self-taught and a giant hack. I have lots of bad habits, and my code is probably laid out pretty poorly. So I wouldn’t look at the code in this project as something to emulate. But if you think any of the in game effects are cool/interesting, access to the code should at least let you go in and figure out how I went about creating them. Hopefully someone finds this useful!
/r/Python
https://redd.it/iy9cx3
Codename Mallow is an adrenaline-charged versus multiplayer game with armless melee battles, one-hit-kill weaponry, and wildly unpredictable stages. Duel for Ninja Supremacy with up to 4 friends in local or online play. Demo & Source Code available NOW!
https://reddit.com/link/iy9cx3/video/4jktd5jy7wo51/player
Demo / Code: [https://ancalabro.itch.io/codename-mallow](https://ancalabro.itch.io/codename-mallow/)
Website: [https://www.codenamemallow.com](https://www.codenamemallow.com/)
To anyone perusing the source code, be warned: I am self-taught and a giant hack. I have lots of bad habits, and my code is probably laid out pretty poorly. So I wouldn’t look at the code in this project as something to emulate. But if you think any of the in game effects are cool/interesting, access to the code should at least let you go in and figure out how I went about creating them. Hopefully someone finds this useful!
/r/Python
https://redd.it/iy9cx3
itch.io
Codename Mallow by Ancalabro
Battle Your Friends for Marshmallow Ninja supremacy! Available for Windows, macOS, Linux
User Groups/Profiles in JupyterHub on Kubernetes
Is it possible to establish user groups or profile templates in JupyterHub? For instance, a normal user would get 2Gi of memory but a data science user would get 4Gi of memory and have a different image.
If not, is it possible to dynamically allocate resources? For example, a user needs more memory, can I add more memory to his pod?
/r/IPython
https://redd.it/iyflmd
Is it possible to establish user groups or profile templates in JupyterHub? For instance, a normal user would get 2Gi of memory but a data science user would get 4Gi of memory and have a different image.
If not, is it possible to dynamically allocate resources? For example, a user needs more memory, can I add more memory to his pod?
/r/IPython
https://redd.it/iyflmd
reddit
User Groups/Profiles in JupyterHub on Kubernetes
Is it possible to establish user groups or profile templates in JupyterHub? For instance, a normal user would get 2Gi of memory but a data science...
My solutions for Cracking the Coding Interview questions
I spent my free time this lockdown summer going through many of the questions in the Cracking the Coding Interview book, the "go-to" resource for interview preparation.
Github: https://github.com/ben-xD/leet
The solutions they give are generally very well explained and the approaches can be ported over to Python, even though the code they give in the print version is Java (which is quite verbose).
The official Python solutions online seems to be a bit lacking, so I've compiled my own after starting to do weekly session with a friend.
Definitely recommend the book, I hope the repo can help anyone going though the questions. Happy to correct any issues/screw-ups :D
/r/Python
https://redd.it/iyltgo
I spent my free time this lockdown summer going through many of the questions in the Cracking the Coding Interview book, the "go-to" resource for interview preparation.
Github: https://github.com/ben-xD/leet
The solutions they give are generally very well explained and the approaches can be ported over to Python, even though the code they give in the print version is Java (which is quite verbose).
The official Python solutions online seems to be a bit lacking, so I've compiled my own after starting to do weekly session with a friend.
Definitely recommend the book, I hope the repo can help anyone going though the questions. Happy to correct any issues/screw-ups :D
/r/Python
https://redd.it/iyltgo
GitHub
StBogdan/CTCI_python
Solutions for Interview questions appearing in the 6th edition of Cracking the Coding Interview (CTCI) - StBogdan/CTCI_python
Updating old projects vs creating new ones
I have made a project that helps me create an excel spreadsheet for work. We changed an aspect of it so I wrote a new program to reflect that. then we added another type of spreadsheet so I recreated it again to incorporate all three types into one. It is a sloppy mess and it needs to be rewritten with class structure instead of the slew of functions that manages the whole thing. in about 4 months I am moving to a different client so what I have created may not even be applicable for the new client.
This got me thinking if I rewrote the program now to be more pythonic it would be easier to change later. I can try to make it smarter and allow a user to adjust the parameters to format it themselves.
Or I could focus on new projects that are more varied. because I am still relatively new to programming (about a year), does it make more sense for me to try and diversify the types of programs and libraries I work with or get more in depth with the ones I know now and learn how to more efficiently rewrite the code I
/r/Python
https://redd.it/iylxnq
I have made a project that helps me create an excel spreadsheet for work. We changed an aspect of it so I wrote a new program to reflect that. then we added another type of spreadsheet so I recreated it again to incorporate all three types into one. It is a sloppy mess and it needs to be rewritten with class structure instead of the slew of functions that manages the whole thing. in about 4 months I am moving to a different client so what I have created may not even be applicable for the new client.
This got me thinking if I rewrote the program now to be more pythonic it would be easier to change later. I can try to make it smarter and allow a user to adjust the parameters to format it themselves.
Or I could focus on new projects that are more varied. because I am still relatively new to programming (about a year), does it make more sense for me to try and diversify the types of programs and libraries I work with or get more in depth with the ones I know now and learn how to more efficiently rewrite the code I
/r/Python
https://redd.it/iylxnq
reddit
Updating old projects vs creating new ones
I have made a project that helps me create an excel spreadsheet for work. We changed an aspect of it so I wrote a new program to reflect that....
Looking for a Technical Co-Founder
Hi everyone, we are searching for a technical founder/CTO who is interested in collaborating on an idea-stage interdisciplinary R&D cloud laboratory for the life sciences. Think Benchling but for all disciplines of life sciences instead of just strictly molecular/biochem, with more workflow-friendly features. If you have experience in a combination of life sciences, coding (be able to build an MVP SaaS solution) and data, then please hit me up and we can talk more!
/r/IPython
https://redd.it/iyg1lc
Hi everyone, we are searching for a technical founder/CTO who is interested in collaborating on an idea-stage interdisciplinary R&D cloud laboratory for the life sciences. Think Benchling but for all disciplines of life sciences instead of just strictly molecular/biochem, with more workflow-friendly features. If you have experience in a combination of life sciences, coding (be able to build an MVP SaaS solution) and data, then please hit me up and we can talk more!
/r/IPython
https://redd.it/iyg1lc
reddit
Looking for a Technical Co-Founder
Hi everyone, we are searching for a technical founder/CTO who is interested in collaborating on an idea-stage interdisciplinary R&D cloud...
REMEMBER_COOKIE_DURATION in flask is not working
Hi
I asked [this question](https://stackoverflow.com/questions/63674125/remember-cookie-duration-in-flask-is-not-working) about 23 days ago on StackOverFlow and it didn't get any answers but I really need to fix this on my application.
In the last 23 days I tried other options but nothing works!
/r/flask
https://redd.it/iytpus
Hi
I asked [this question](https://stackoverflow.com/questions/63674125/remember-cookie-duration-in-flask-is-not-working) about 23 days ago on StackOverFlow and it didn't get any answers but I really need to fix this on my application.
In the last 23 days I tried other options but nothing works!
/r/flask
https://redd.it/iytpus
Stack Overflow
REMEMBER_COOKIE_DURATION in flask is not working
I am trying to configure my application to expire cookies after some amount of time however they are not working as expected, my cookies don't get expired at all.
I have the following configuration...
I have the following configuration...
views or serializers (Django rest framework). Need help in approach to create a json
im having doubts in what approach i have to follow.
I need to fetch data from multiple models. Do filterings & loop on it and cross check and do calculations from different model data and finally present a json with only the required data for the front end.
Is it possible to do all this via serializers?
Can i pass a list(queryset), loop on it and for each element get data from other models etc.
If yes how do i go about it?
The tutorials are mainly limited to creating fields with serializers or using a meta modal.
Or is views.py the best resort since i'll be more in control with what i can fetch and write, plus end up writing a custom dictionary to output as a json.
/r/djangolearning
https://redd.it/iyxvn5
im having doubts in what approach i have to follow.
I need to fetch data from multiple models. Do filterings & loop on it and cross check and do calculations from different model data and finally present a json with only the required data for the front end.
Is it possible to do all this via serializers?
Can i pass a list(queryset), loop on it and for each element get data from other models etc.
If yes how do i go about it?
The tutorials are mainly limited to creating fields with serializers or using a meta modal.
Or is views.py the best resort since i'll be more in control with what i can fetch and write, plus end up writing a custom dictionary to output as a json.
/r/djangolearning
https://redd.it/iyxvn5
reddit
views or serializers (Django rest framework). Need help in...
im having doubts in what approach i have to follow. I need to fetch data from multiple models. Do filterings & loop on it and cross check and do...
[FREE] Django with GeoLocation - United Academy
https://unitedaca.com/free-django-with-geolocation/
/r/djangolearning
https://redd.it/iyw5mx
https://unitedaca.com/free-django-with-geolocation/
/r/djangolearning
https://redd.it/iyw5mx
United Academy
[FREE] Django with GeoLocation - United Academy
Django Geolocation with folium explained in a project based tutorial
Friday megathread: Free chat Friday!
Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!
/r/Python
https://redd.it/iz8v43
Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!
/r/Python
https://redd.it/iz8v43
reddit
Friday megathread: Free chat Friday!
Use this thread to talk about anything Python related! Questions, news, projects and any relevant discussion around Python is permitted!
Why '&' changes to '&' when it gets to frontend? (FLASK-REACT)
I am working on a project with Flask backend and React frontend.
I send data like this
`auth_url = '`[`https://abc.com/tr/authorize?client_id=abc&response_type=code&`](https://accounts.spotify.com/tr/authorize?client_id=a2a038c0cf9f4fb08c36873347d16858&response_type=code&redirect_uri=http:%2F%2F127.0.0.1:5000&scope=playlist-modify-private%20user-read-currently-playing&show_dialog=True)`'`
`return render_template('index.html', auth_url=auth_url, page_name='sign_in')`
When I call this url from React, it changes '&' to '&', why it does it make this change.
I did some googling most of the responses says it is due to security reasons.
/r/flask
https://redd.it/iz3gbi
I am working on a project with Flask backend and React frontend.
I send data like this
`auth_url = '`[`https://abc.com/tr/authorize?client_id=abc&response_type=code&`](https://accounts.spotify.com/tr/authorize?client_id=a2a038c0cf9f4fb08c36873347d16858&response_type=code&redirect_uri=http:%2F%2F127.0.0.1:5000&scope=playlist-modify-private%20user-read-currently-playing&show_dialog=True)`'`
`return render_template('index.html', auth_url=auth_url, page_name='sign_in')`
When I call this url from React, it changes '&' to '&', why it does it make this change.
I did some googling most of the responses says it is due to security reasons.
/r/flask
https://redd.it/iz3gbi
What is the correct way to create Virtual Environment for a project.
I 've seen several ways to create "Virtual Environment" in tutorials. Can someone tell me what the correct way is or better way. I'm pretty new to Django and Web-Dev, and my first Django tutorial was using this command: python -m venv project_env (new environment name). This works without any issue, but I would like to know if this is proper way. Any help will be greatly appreciated. Thank you.
/r/django
https://redd.it/iz1ogt
I 've seen several ways to create "Virtual Environment" in tutorials. Can someone tell me what the correct way is or better way. I'm pretty new to Django and Web-Dev, and my first Django tutorial was using this command: python -m venv project_env (new environment name). This works without any issue, but I would like to know if this is proper way. Any help will be greatly appreciated. Thank you.
/r/django
https://redd.it/iz1ogt
reddit
What is the correct way to create Virtual Environment for a project.
I 've seen several ways to create "Virtual Environment" in tutorials. Can someone tell me what the correct way is or better way. I'm pretty new to...
Python and FastAI to Qualify at Fall Guys
https://youtu.be/GS_0ZKzrvk0
/r/Python
https://redd.it/iz0agr
https://youtu.be/GS_0ZKzrvk0
/r/Python
https://redd.it/iz0agr
YouTube
FastAI learns to play Fall Guys - Undetectable Fall Guys bot.
I used the very powerful FastAI library with Python to play Fall Guys and qualify over human players. These AI bots are fun and easy to code with FastAI and undetectable by anti-cheat efforts. Join us and share this video to stop these bots!
Want to chat…
Want to chat…
Data Science (Decision trees) - Please help! DM Me if you can for venmo/paypal/cashapp
Python help $$$$
Need help with this project looking for a pro thats affordable.
/r/JupyterNotebooks
https://redd.it/izcidj
Python help $$$$
Need help with this project looking for a pro thats affordable.
/r/JupyterNotebooks
https://redd.it/izcidj
reddit
Data Science (Decision trees) - Please help! DM Me if you can for...
Python help $$$$ Need help with this project looking for a pro thats affordable.
Automated My Job for the First Time
So this just happened today. I've been learning Python on and off for a long time. I had to take a couple of classes for my undergrad a couple years back, and after that, I never really needed to apply it in my job.
Fast forward to today, my manager was complaining about how many requests for test data the business team was giving him. He tasked me with helping him generate the data using Excel and advanced SQL logic.
I decided to dust off my rusty Python scripting knowledge and created a script that automated the entire process. It took many hours, a lot of googling and 2 mugs of coffee, but I accomplished what I set out to do. My script was able to generate nearly 5000 queries in less than a minute.
Needless to say, my boss was impressed by my initiative, and I've found out first hand how useful knowing Python is. I want to thank this subreddit for being so supportive and always promoting new learning resources. Automate the Boring Stuff is a gold mine of info and I am more motivated than ever before to expand my skills and knowledge!
/r/Python
https://redd.it/izdclm
So this just happened today. I've been learning Python on and off for a long time. I had to take a couple of classes for my undergrad a couple years back, and after that, I never really needed to apply it in my job.
Fast forward to today, my manager was complaining about how many requests for test data the business team was giving him. He tasked me with helping him generate the data using Excel and advanced SQL logic.
I decided to dust off my rusty Python scripting knowledge and created a script that automated the entire process. It took many hours, a lot of googling and 2 mugs of coffee, but I accomplished what I set out to do. My script was able to generate nearly 5000 queries in less than a minute.
Needless to say, my boss was impressed by my initiative, and I've found out first hand how useful knowing Python is. I want to thank this subreddit for being so supportive and always promoting new learning resources. Automate the Boring Stuff is a gold mine of info and I am more motivated than ever before to expand my skills and knowledge!
/r/Python
https://redd.it/izdclm
reddit
Automated My Job for the First Time
So this just happened today. I've been learning Python on and off for a long time. I had to take a couple of classes for my undergrad a couple...