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
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
flask_login AnonymousUserMixin and then logs me out

Im having an issue with flask\_login when I log in with login\_user(user, remember=True) the **current\_user** is set to a valid user however when I refresh the page a few times it changes the current\_user to <flask\_login.mixins.AnonymousUserMixin object at 0x7f4f3ab7bb70> and logs me out.

&#x200B;

Do you have any idea why ??

/r/flask
https://redd.it/aq3pns
flask blueprints and before_request

I have a flask app with multiple blueprints for various sub components of the site.

&#x200B;

Pre-blueprint - I used app.before\_request() to query my database for content that would influence the menu tree, ie overlays for menu items that would indicate new content or number of new items.

&#x200B;

Now that i'm using blueprints, i have a 'main' blueprint + 'events' blueprint. Main has the @main.before\_request, which generates the content for the menu, but the events blueprint doesn't know to call the main.before\_request.

&#x200B;

Also, in before\_request() i've been using the 'g' global object to create the attributes that eventually get referenced in the menu template. is this good practice?

&#x200B;

Thanks!

/r/flask
https://redd.it/apwtm9
Help with turtle?

I am trying to make my boyfriend an e-card by sending him the code (He's a computer programmer). I am awful at coding and cannot seem to get the time that turtle draws my card down. I tried using turtle.time(arg) where arg was set to 0 or 'fastest'. Neither worked. Can anyone show me how to reduce the time that the picture takes to draw the flower?

I'm using python 3. Thank you for any help you can provide!

##### imports #####
import turtle

##### defines a function and sets parameters for graph #####
def draw_petal (turtle, radius):
heading = turtle.heading()
turtle.circle(radius, 60)
turtle.left(120)
turtle.circle(radius,60)
turtle.setheading(heading)

##### variables for petal numbers and radius of petals #####
my_radius = int(150)
my_petals = int(10)



/r/Python
https://redd.it/aq4mbh