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
Is this route okay to use?

QUESTION: Would I encounter any problem if I forward with these code below?

Right now it is working without any problem as far as I can see.

So here is my User model. The "paid" column's value will decide if the user can reach a specific page which is only available for the users that have paid the user fee.

class User(db.Model,UserMixin):
__tablename__='Users'id=db.Column(db.Integer,primary_key=True)
email=db.Column(db.String(50),unique=True,nullable=False)
password=db.Column(db.String(60),nullable=False)
paid=db.Column(db.Integer,default='0',nullable=False)
role_id = db.Column(db.Integer, db.ForeignKey('roles.id'))

Here it is one of my routes for activating user account . This route is for when the admin gets a payment notification from the user, the admin will go and activate the user account manually. So I put a basic checkbox and email section in the template. When the admin submit, it changes "paid" column to "1" or "0" to a particular user email address.

#ACTIVATE USER
@admin.route('/user_activate',methods=['GET','POST'])
@login_required
@is_admin()
def activate():


/r/flask
https://redd.it/xxx73l
only backend portfolio ideas with no front-end.

Hello everyone! Sorry if this is an OT, admins can remove it if it's unacceptable in this place. I am learning and getting good at flask. My question is, what are some only backend projects that does not require front-end and would be good for portfolio? The reason why I am asking this is not because I don't know html/css/javascript (in fact I know them as code very well), it's because I am blind and obviously, I can't do designs. Since I am good at programming and logic, backend seems a good fit. What I have looked up in the internet about the topic is to build some APIs. They don't require any front-end knowledge. This was as far as I could get with my searches. Other projects like shops, class management system, portfolio projects and etc, are of course requiring front-end. Taking a template and modifying it probably is not the option, because then you are limited with the features that you could add, for example in the class management system project. With only backend, you'd do unit/integration tests and showcase that your project works. but there is a lack of ideas, building is the next step.

sincerely and with

/r/flask
https://redd.it/xy5nbw
Running Jupyter lab/notebook fail

Hey y'all I was running jupyter notebook/lab just a few days ago and have suddenly run into an issue I can't resolve.

https://preview.redd.it/6ge5cg6fore91.png?width=2348&format=png&auto=webp&s=d92c0300b516632e0ce80402ddcbea5956635285

I'm getting the above error just trying to run jupyterlab or notebook within (and without) a virtualenv. I'm not aware of any package changes or anything since this was last working but something must have changed. Most of the advice I'm finding online is relatively old on this issue and revolve around downgrading markupsafe package from 2.1.1 to 2.0.1. I've tried this and it hasn't fixed the issue.

Another issue, when Lab/Notebook was working, was the autotab feature and shift+tab documentation feature were working in the beginning but became very slow or stopped working altogether. Most advice around this issue revolved around jedi upgrades/downgrades/changing jedi config setting to false. I feel like I exhausted all combinations.

Any thought on either of these two issue would be greatly appreciated.

/r/JupyterNotebooks
https://redd.it/wc6vze
Im making a video editor in Python. Yes, i'm crazy. No, it wont lag

# Motive

I am making a video editor in Python due to a lack of free editors who have the features i want them to have, without needing a super beefy computer to run, I'm talking: keyframes, 3d animations, etc.

This was a spontaneus decision by me because a malaysian friend was forced to use kinemaster because his pcs have no more than a core 2 duo.

Why wont i use something else?

Because python is really easy to just get stuff working without making a ton of bullsh boilerplate just to move an image in 3d or paste and image on top of another.

# The backstory

There is a genre of videos called "crazy errors" they were quite popular back in 2011-2014, they involve error messages popping up in rythm to music, making it look like a virus (the video itself was most commonly made in a video editor like premiere or vegas pro). It most commonly featured IOSYS's "Marisa Stole the Precious Thing", although other songs could appear too.


It was near the end of 2020, back then I found out that windows93.net has a crazy error program. The difference is, is that the errors that popup, are actually interactive and are real windows

/r/Python
https://redd.it/xxrs6j
Unable to get value from render_template!

This is my main.html : [https://pastebin.com/794UYRrz](https://pastebin.com/794UYRrz)

and this is my [app.py](https://app.py) : [https://pastebin.com/68RXwiMc](https://pastebin.com/68RXwiMc)

​

Basically i want whenever i get a POST to update the textarea but it doesnt work..

i tried with fetch("/", {method: "POST"}) but whenever i get a post like that or one from dropzone, it doesnt return the values as true

/r/flask
https://redd.it/xyemzy
Execute Notebook on remote kernel via cmd

Hi, I'm currently trying to run a remote notebook via command shell. I was able to connect to the remote kernel with the GatewayClient option and also could start my local notebooks on that kernel using the Browser. But I didn't find a way to use the established connection to execute a notebook using the command shell.
Can anybody help me with this? Either a way in python or directly via command prompt would be nice!

/r/JupyterNotebooks
https://redd.it/wcamn2
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/xye4ru
Is it just me or did the creators of the Python QT5 GUI library miss a golden opportunity to call the package QtPy?



/r/Python
https://redd.it/xykohy
Colab/jupyter hub/google drive/github?

I frequently switch between two devices, one windows and another Mac. I'm wondering what the best way to store my jupyter notebooks would be. The code is all fairly light. I'm just reading in data and graphing it. The notebook will be single-user.

The code runs significantly slower on google Colab than if I run them on my local machines, but nothing unbearable, and speed isn't a huge issue. That said, fast wall times are always better. I also haven't fully dug deep into Colab yet so IDK how it compares with standard jupyter in terms of functionality. Most online comparisons emphasize on ML capabilities, but again I'm not doing anything that fancy.

I briefly read up on jupyter hub, but I haven't tried it out yet. I only have a linux machine with crappy hardware that's up 24-7, and I'm often not on the same internet as the linux machine, so I'd probably have to tailscale back. I can't setup port forwarding with my internet administration privileges.

The other alternatives are to store the jupyter notebooks either on google drive and mount it to my local devices, or to push the code to github and pull before every use. I

/r/IPython
https://redd.it/xynkpi
I wrote a document generator for YAML files in Python

I wrote C# for years, and this is one of my first Python projects that is not a fork.

​

It started as a thought experiment, if OpenSearch can generated documentation automatically for configuration files in YAML, like JavaDoc or doxygen. I proposed this idea and tried to come up with a POC. And this is it. You can have a check at the short Readme about how it works.

​

https://github.com/zbalkan/yaml-docs

/r/Python
https://redd.it/xyebbv
rendering a notebook with RTL language

Hi all,

​

I'd like to know if there is a way to render a notebook into an html doc with an RTL language?

​

I've added <div dir="rtl" lang="he" xml:lang="he"> to the markdown cells but it's just rendering with the tags.. nothing else..

&#x200B;

hope someone can help me.

/r/JupyterNotebooks
https://redd.it/wb9gfz
A Rookie SEO Question

Let's suppose I am building a catalog website (e.g., e-commerce, real estate listings, electronic library, etc.)

In the real estate example, I may have three tables in my database: info about the house, the neighborhood, and the county the house is in.

When a user visits the website, s/he enters an address on the main page, and on the results page, s/he is returned aggregated and summarized data from the tables mentioned above.

This part is fairly straightforward, but I don't understand how to make search engines index this data. If the result pages only exist when someone is sending a request, how can I ensure that when people search for the same house on google, they see the page on my website that includes information about that house?

I guess I can create pages for everything house in the database and store them on the server, but it doesn't sound like the best solution, does it?

Please let me know what you guys think.

/r/flask
https://redd.it/xyyrzv
This media is not supported in your browser
VIEW IN TELEGRAM
[R] VToonify: Controllable High-Resolution Portrait Video Style Transfer

https://redd.it/xyxe8w
@pythondaily
Sunday Daily Thread: 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/xz7dtg
I wrote a filter for Django Compressor that removes unused CSS classes and makes your СSS files much smaller

I really enjoy simple, lightweight, and fast websites so I always try to keep my CSS and JS files as small as possible. I also like using Bootstrap for my projects since it helps to build a prototype to test the idea without much effort. However, Bootstrap and Tailwind CSS files are pretty large which directly influences the loading and render time of a website. To solve the problem, I wrote a filter for the amazing app Django Compressor that uses the PurgeCSS tool to remove unused CSS classes from your files and reduce the size of your CSS files size several times.

The filter automatically discovers all your Django templates, finds which classes are not used, and removes them. Thanks to the Django Compressor, it happens on the fly, so you don't need to manually run the PurgeCSS tool and copy/paste optimized styles every time you changed your styles. Moreover, Django Compressor allows you to use the filter alongside other filters, so you can also compile your SCSS files, compress CSS files, etc.

So far I tested it on one of my websites and it reduced my CSS files from \~200 Kb to 60 Kb (I use almost all Bootstrap components

/r/django
https://redd.it/xys6y4
If you're a beginner interested in data science and machine learning, I recently produced a video series that goes through all of the major algorithms and their implementations in Python! I put a lot of work into each tutorial, so hopefully this helps out!
https://youtube.com/playlist?list=PLvICEeb-TZEHKkojcv1_POKPrCwlsEnsI

/r/Python
https://redd.it/xyyj9t
Compatibility between Colab ipynb and local Jupyter notebook?

I've been using Google's Colab environment for a coursework - and my understanding is it's a mostly reskinned version of Jupyter notebook.

Can I assume ipynb notebooks exported from Colab to be compatible with my machine's local Jupyter installation? Are there known pitfalls or incompatibilities I should be aware of?

&#x200B;

Thank you!

/r/IPython
https://redd.it/xyn9k5
Can you rate my project, and tell am I ready for internship or junior position?

Here is my django project, I didn't know what to do and just create some social network app.

Please just tell me what did i do wrong and what should i learn

/r/django
https://redd.it/xzhtei
I’m getting this import error when trying to open Jupyter. When I closed it, some files were still running so I’m not sure if that affected this. Can anyone help?

/r/JupyterNotebooks
https://redd.it/xz80nz