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
Here we go

/r/Python
https://redd.it/apndyq
Using Alembic to migrate money stored in Dollars as Floats to Money stored in Cents as BigInt?

I think the title says it all, but I really don't want to mess with this stuff without some sort of verdict.

I need to transfer some pricing data, currently stored as Floats, into BigInts using alembic.

I know HOW to do the migration, in the sense that I know how to change the floats to bigints - but what about the users who have their data stored as Floats currently - what's going to happen?

Is it possible to use alembic to transform those floats by some simple Python script (say like, int(old_value*100)) in my Alembic upgrade?

Thanks!

/r/flask
https://redd.it/apnjvs
Image won't render with copy-pasted code unless I go to Edit > Insert Image

Hello everyone, I was trying to render an image by copying the code

![1.png](attachment:1.png)

and pasting it to my cell however nothing happens. It's only when I manually do Edit > Insert Image that it works... Is there a way to make images load through code?

Also can I make it like `![](attachment:1.png)` instead?

Thanks!

/r/IPython
https://redd.it/appegh
What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.


/r/Python
https://redd.it/aptowq
We're not that bad

/r/Python
https://redd.it/apt413
Question : Exactly how much of the tasks should be done in templates

I am a beginner and still learning flask. So this might come off as a stupid question.

Jinja supports s bit of python-like code to be added to the html files. Depending on the coding style of the user, he/she can use multiple for loops and if-else blocks in templates.

In what kind of cases should the code be in jinja templates vs in route handlers.

Are there some best practices to be followed as to where to do what tasks(in templates vs route handlers)

​

Sorry for my poor English. Thank You :)

/r/flask
https://redd.it/apump6
Python joke in How to Kill the Dragon with 9 Programming Languages

I'm sure developers have seen [this](https://blog.toggl.com/kill-dragon-comic/) comic strip, they also have the GIT princess comic.

I don't understand the part about Python, is the underlying joke about importing libraries for a specific task?

/r/Python
https://redd.it/apw2b0
I streamed myself creating an animated, ASCII-art aquarium that runs in the terminal.

I created an animated, ASCII-art aquarium that runs in the terminal. https://github.com/asweigart/PythonStdioGames/blob/master/src/aquarium.py

You'll need to run `pip install bext` first (Bext provides cross-platform, curses-like features to have color text, move the text cursor to x, y locations, etc. Docs at https://github.com/asweigart/bext )

The stream I made this on will only be up for a few days, but the link is here: https://www.twitch.tv/videos/379310819

I plan on making a edited, polished video of the process of making this in the future. (The stream is 5 hours long and rather disjointed, the video will be a 15 or 20 minute thing.)

/r/Python
https://redd.it/apys8k
I'm doing a series on computer photography in jupyter notebook form

Here is a demo of what I have so far:

[https://github.com/VideoForensics/computerPhotography](https://github.com/VideoForensics/computerPhotography)


What are some best practices I should incorporate?

/r/IPython
https://redd.it/apyizu
Automatically update web page when database is updated

Hi, I have created a front end application in Python using the Flask framework.

I just finished setting up an AWS mySQL RDS instance that my app reads and writes to.

Currently, if I use software such as mySQL workbench to add rows to my tables, I have to refresh the webpage in order to see this added data. I attempted researching flask-socketio to accomplish this, but I had difficulty translating basic tutorials into the full app that I already have developed. I am new to web app development, which explains why I couldn't figure out what/where I needed to add socketio code.

​

Any help or guidance would be much appreciated, thanks.

/r/flask
https://redd.it/apytyc
Any cryptocurrency or blockchain in production state written in python you can suggest to have a look at?

( list of ALL crypto and blockchain projects built mainly on python would be very appreciated if manteined and updated someware, if existing jet.. )

/r/Python
https://redd.it/aq1swp
Django REST how to not check foreign keys?

I have a table that is just a bunch of foreign keys to other tables. Trying to insert a new row to this table by doing a POST to Django REST api, Django then does like 10 SELECTs to verify each foreign key exists and then does the INSERT.

Is there an some easy way to not do these foreign key checks? They seem very pointless, the INSERT will fail if any of the foreign keys do not exist.

/r/djangolearning
https://redd.it/aq2dn9
Project Review

Can someone look at my project, its pretty much finished and I might update it later, however can someone look over it and tell me how it is?

the project is at [https://github.com/Abemarkar23/Quizer](https://github.com/Abemarkar23/Quizer)

Thank You

​

/r/flask
https://redd.it/aq0uc1