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/uptmup
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/uptmup
reddit
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...
How do you name the project directory?
It is about convention so I can do whatever I want at the end of the day. But let me ask this question.
By "project directory" I mean the inner mysite/ directory in the official Django tutorial.
In the official tutorial, the outer directory and the inner directory have the same name and I find it kind of confusing.
So I named it "config". But something doesn't feel right.
And I still find it confusing because you can have other config files or directories when developing with Django such as setup.cfg and pre-commit-config.yaml etc...
I prefer "project_config". But the name's kinda long and as far as I know, nobody uses it.
Some people apparently prefer"project".
https://forum.djangoproject.com/t/project-naming-conventions/339
What do you think about the name "project_config"? Redundant?
And how do you name the project directory?
/r/django
https://redd.it/uq06st
It is about convention so I can do whatever I want at the end of the day. But let me ask this question.
By "project directory" I mean the inner mysite/ directory in the official Django tutorial.
In the official tutorial, the outer directory and the inner directory have the same name and I find it kind of confusing.
So I named it "config". But something doesn't feel right.
And I still find it confusing because you can have other config files or directories when developing with Django such as setup.cfg and pre-commit-config.yaml etc...
I prefer "project_config". But the name's kinda long and as far as I know, nobody uses it.
Some people apparently prefer"project".
https://forum.djangoproject.com/t/project-naming-conventions/339
What do you think about the name "project_config"? Redundant?
And how do you name the project directory?
/r/django
https://redd.it/uq06st
Django Forum
"Project" Naming Conventions
Django newb here, I have seen a few articles touching on this topic but nothing that answered the question for me. I’m wondering how people prefer to name their project in Django. I’ve seen a variety of different ways: “project”, “config”, or even “app”.…
how can I create a startup notebook in jupyterlab preloaded with some imports and other code?
/r/JupyterNotebooks
https://redd.it/ubprl6
/r/JupyterNotebooks
https://redd.it/ubprl6
reddit
r/JupyterNotebooks - how can I create a startup notebook in jupyterlab preloaded with some imports and other code?
3 votes and 2 comments so far on Reddit
I made a package that prints trees to the console
​
https://preview.redd.it/ig0oabgn6lz81.jpg?width=469&format=pjpg&auto=webp&s=5d4114e527373799d18d77d193f1071f1c6c13c0
https://github.com/AharonSambol/PrettyPrintTree
I couldn't find any good way to print trees to the console... So I made one :)
It helps a ton with debugging!
/r/Python
https://redd.it/uq0bdo
​
https://preview.redd.it/ig0oabgn6lz81.jpg?width=469&format=pjpg&auto=webp&s=5d4114e527373799d18d77d193f1071f1c6c13c0
https://github.com/AharonSambol/PrettyPrintTree
I couldn't find any good way to print trees to the console... So I made one :)
It helps a ton with debugging!
/r/Python
https://redd.it/uq0bdo
Convert your Jupyter notebook into Machine Learning web app using Mercury framework..
https://www.analyticsvidhya.com/blog/2022/04/how-to-convert-jupyter-notebook-into-ml-web-app/
/r/JupyterNotebooks
https://redd.it/twk2jm
https://www.analyticsvidhya.com/blog/2022/04/how-to-convert-jupyter-notebook-into-ml-web-app/
/r/JupyterNotebooks
https://redd.it/twk2jm
Analytics Vidhya
How to Convert Jupyter Notebook into ML Web App?
In this article, we will see how to convert the Jupyter notebook into an application and deploy it on the Heroku platform.
Web Scraping with Python: Everything you need to know to get started (2022)
https://www.scrapingbee.com/blog/web-scraping-101-with-python/
/r/Python
https://redd.it/uqabuy
https://www.scrapingbee.com/blog/web-scraping-101-with-python/
/r/Python
https://redd.it/uqabuy
Scrapingbee
Python Web Scraping: Full Tutorial With Examples (2025) | ScrapingBee
Learn about web scraping in Python with this step-by-step tutorial. We will cover almost all of the tools Python offers to scrape the web. From Requests to BeautifulSoup, Scrapy, Selenium and more.
Length, First, Last Three Characters of a String Character at a Given Index Reverse a String
http://www.youtube.com/watch?v=hZsRWblEKwg
/r/IPython
https://redd.it/nlv6mp
http://www.youtube.com/watch?v=hZsRWblEKwg
/r/IPython
https://redd.it/nlv6mp
YouTube
01 Length, First, Last Three Characters of a String Character at a Given Index Reverse a String
Length of a String
Character at a Given Index
Reverse a String
First and Last Three Characters of a String
THANKS FOR WATCHING AND DON'T FORGET TO LIKE, COMMENT, SUBSCRIBE, AND HIT THE BELL ICON TO WATCH THE LATEST VIDEO!
#edudream #python
-~-~~-~~~…
Character at a Given Index
Reverse a String
First and Last Three Characters of a String
THANKS FOR WATCHING AND DON'T FORGET TO LIKE, COMMENT, SUBSCRIBE, AND HIT THE BELL ICON TO WATCH THE LATEST VIDEO!
#edudream #python
-~-~~-~~~…
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/uqixn0
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.
/r/Python
https://redd.it/uqixn0
reddit
Monday Daily Thread: Project ideas!
Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with...
Is it safe to send JWT token in register verification email in Django rest framework?
/r/django
https://redd.it/urfgwj
/r/django
https://redd.it/urfgwj
reddit
Is it safe to send JWT token in register verification email in...
Posted in r/django by u/Okayokay1026 • 5 points and 4 comments
How to multiply matrices in Python (Spyder IDE)
https://youtube.com/watch?v=hVhRHOqlJ2I&feature=share
/r/IPython
https://redd.it/lqrva5
https://youtube.com/watch?v=hVhRHOqlJ2I&feature=share
/r/IPython
https://redd.it/lqrva5
YouTube
How to multiply matrices in Python (Spyder IDE)
❖ This tutorial video provides a basic introduction to How to Multiply Matrices in Python. We have used Spyder IDE for programming in the Python language. Also, this video contains many examples and practice problems on Matrix Multiplication.
❖ Any matrix…
❖ Any matrix…
Where to put things to be shared among different apps
I'm working on a personal project relating the backend for a point of sale app. I'd like to know the best approach for locating things like Models, Serializers and Views (among other things) that are not related to a specific app and are shared among all of them.
For example, my apps are:
* authentication (relating users)
* client
* quote
* sale
I added a new app called helper which for example has:
* A model module where a have a BaseModel with *created\_at* and *updated\_ad* fields from which most of my models on my apps inherit.
* A views module that has CRDViewSet and CRViewSet, which are Create Read Delete and Create Read ViewSets which inherit from GenericViewSet and the needed mixins, and are used on some views on the other apps.
* A validators module with functions that validate things like a positive value, not negative value, and acceptable future date, among other things which also are validations shared and used in different serializers on my apps.
Is it okay for this *helper* app to exist or is there a more recommended way to have these different structures which are shared among apps?
​
Edit: Thanks for all your answers, I agree that core sounds a lot better
/r/django
https://redd.it/urddpe
I'm working on a personal project relating the backend for a point of sale app. I'd like to know the best approach for locating things like Models, Serializers and Views (among other things) that are not related to a specific app and are shared among all of them.
For example, my apps are:
* authentication (relating users)
* client
* quote
* sale
I added a new app called helper which for example has:
* A model module where a have a BaseModel with *created\_at* and *updated\_ad* fields from which most of my models on my apps inherit.
* A views module that has CRDViewSet and CRViewSet, which are Create Read Delete and Create Read ViewSets which inherit from GenericViewSet and the needed mixins, and are used on some views on the other apps.
* A validators module with functions that validate things like a positive value, not negative value, and acceptable future date, among other things which also are validations shared and used in different serializers on my apps.
Is it okay for this *helper* app to exist or is there a more recommended way to have these different structures which are shared among apps?
​
Edit: Thanks for all your answers, I agree that core sounds a lot better
/r/django
https://redd.it/urddpe
reddit
Where to put things to be shared among different apps
I'm working on a personal project relating the backend for a point of sale app. I'd like to know the best approach for locating things like...
Trying to access an element in the dictionary but it's printing the entire dictionary
debug={
"cat":"cat-value",
"dog":"dog-value
}
When I run the following:
{% for cat, value in debug.items %}
{{ value }}
{% endfor %}
The output is "cat-value dog-value", the entire dictionary. How do I only take "cat"
/r/django
https://redd.it/urszoo
debug={
"cat":"cat-value",
"dog":"dog-value
}
When I run the following:
{% for cat, value in debug.items %}
{{ value }}
{% endfor %}
The output is "cat-value dog-value", the entire dictionary. How do I only take "cat"
/r/django
https://redd.it/urszoo
reddit
Trying to access an element in the dictionary but it's printing...
debug={ "cat":"cat-value", "dog":"dog-value } When I run the following: {% for cat, value in debug.items %} {{...
Dockerizing a Flask app : FileNotFoundError: Errno 2 No such file or directory: '/app/app.py': '/app/app.py'
Hello everyone, I hope you're doing great.
I'm desperatly trying to dockerize an opensource Flask app (open web calendar).
But I keep getting this error at the end:
FileNotFoundError: Errno 2 No such file or directory: '/app/app.py': '/app/app.py'
But the weird thing is that I get this error from running app.py which is definitely in /app.
I have pushed all the files to a GitHub repo. An other even weirder thing is that if I use git-clone \-> python app.py on my computer, the app works like a charm but if I do the exact same two commands inside a Python 3.7.9 container it crashes with this error (I was using python:3.7.9-slim-buster image)...
This is why I'm quite sure it's not an issue with my Dockerfile.
EDIT: As requested by many, here is the Dockerfile:
FROM python:3.7.9-slim-buster
WORKDIR /app
COPY requirements.txt /app
RUN pip3 install --no-cache-dir -r requirements.txt
COPY . /app
CMD "python3", "/app/app.py"
I am using Python 3.7.9 (as specified in the runtime.txt).
Here is the
/r/flask
https://redd.it/usclze
Hello everyone, I hope you're doing great.
I'm desperatly trying to dockerize an opensource Flask app (open web calendar).
But I keep getting this error at the end:
FileNotFoundError: Errno 2 No such file or directory: '/app/app.py': '/app/app.py'
But the weird thing is that I get this error from running app.py which is definitely in /app.
I have pushed all the files to a GitHub repo. An other even weirder thing is that if I use git-clone \-> python app.py on my computer, the app works like a charm but if I do the exact same two commands inside a Python 3.7.9 container it crashes with this error (I was using python:3.7.9-slim-buster image)...
This is why I'm quite sure it's not an issue with my Dockerfile.
EDIT: As requested by many, here is the Dockerfile:
FROM python:3.7.9-slim-buster
WORKDIR /app
COPY requirements.txt /app
RUN pip3 install --no-cache-dir -r requirements.txt
COPY . /app
CMD "python3", "/app/app.py"
I am using Python 3.7.9 (as specified in the runtime.txt).
Here is the
/r/flask
https://redd.it/usclze
GitHub
GitHub - niccokunzmann/open-web-calendar: Embed a highly customizable web calendar into your website using ICal source links
Embed a highly customizable web calendar into your website using ICal source links - niccokunzmann/open-web-calendar
Wednesday Daily Thread: Beginner questions
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/urzy9j
New to Python and have questions? Use this thread to ask anything about Python, there are no bad questions!
This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.
/r/Python
https://redd.it/urzy9j
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
Code cells not showing in HTML
After one of the recent updates I have a problem with HTML-output. The list of possible formats in the “Save as” menu has some new elements. Including “HTML without code”.
However, when I try to save a HTML-file I never get any code cells. Not when using the mentioned alternative (as expected), nor when I use the regular “Save as HTML”- option. The files are identical.
Does anyone have any idea? 💡
/r/JupyterNotebooks
https://redd.it/usemhs
After one of the recent updates I have a problem with HTML-output. The list of possible formats in the “Save as” menu has some new elements. Including “HTML without code”.
However, when I try to save a HTML-file I never get any code cells. Not when using the mentioned alternative (as expected), nor when I use the regular “Save as HTML”- option. The files are identical.
Does anyone have any idea? 💡
/r/JupyterNotebooks
https://redd.it/usemhs
reddit
Code cells not showing in HTML
After one of the recent updates I have a problem with HTML-output. The list of possible formats in the “Save as” menu has some new elements....
How to Run Jupyter In Any Cloud With TPI Terraform Plugin
The following study shows a few distinct advantages of TPI to solve pain points related to maintaining your software and hardware stack as well as being limited by the hardware you own: [Using Jupyter/TensorBoard In Any Cloud With One Command](https://www.devforce.one/16373548/how-to-run-jupyter-in-any-cloud-with-one-command#/)
* Lower cost: use your preferred cloud provider's existing pricing, including on-demand per-second billing and bulk discounts.
* Auto-recovery: spot/preemptible instances are cheap but unreliable. TPI reliably and automatically respawns such interrupted instances, caching & restoring the working directory in the cloud even when you are offline.
* Custom spec: full control over hardware & software requirements via a single config file.
/r/JupyterNotebooks
https://redd.it/usl77o
The following study shows a few distinct advantages of TPI to solve pain points related to maintaining your software and hardware stack as well as being limited by the hardware you own: [Using Jupyter/TensorBoard In Any Cloud With One Command](https://www.devforce.one/16373548/how-to-run-jupyter-in-any-cloud-with-one-command#/)
* Lower cost: use your preferred cloud provider's existing pricing, including on-demand per-second billing and bulk discounts.
* Auto-recovery: spot/preemptible instances are cheap but unreliable. TPI reliably and automatically respawns such interrupted instances, caching & restoring the working directory in the cloud even when you are offline.
* Custom spec: full control over hardware & software requirements via a single config file.
/r/JupyterNotebooks
https://redd.it/usl77o
devforce.one
How to Run Jupyter In Any Cloud With One Command
Two pain points often faced by scientists and engineers are:
Installing and maintaining your entire software stack (including GPU drivers and dependencies) is difficult and time-consuming, and
Being limited by the hardware you own (laptop or desktop specs).…
Installing and maintaining your entire software stack (including GPU drivers and dependencies) is difficult and time-consuming, and
Being limited by the hardware you own (laptop or desktop specs).…
Different foreignkey by condition in one model
Hi, I have a website that has a student and a teacher side. As a teacher you can track students progress in an elearning platform. There are 4 different ways that you can track a student.
Quiz, Fillinblanks, Read the chapter, Watched the video. (Each represents a model)
​
I want to make a model that lets the teacher assign homework for the student. I want to be able to make a model that is different depending on which homework you assign (Quiz, Fillinblanks etc..)
​
So if the teacher wants to assign a quiz and a watched the video for chapter 3.1 I want the model to do two rows. One for the quiz and one for the video, linked with foreign keys to the respective model so you track if the homework is done.
​
Is there an easy way to do this without using 8 tables for all of it. I read up on generic relations but I can't really figure out how to apply that to this situation.
Thanks for any help.
/r/django
https://redd.it/ut15qt
Hi, I have a website that has a student and a teacher side. As a teacher you can track students progress in an elearning platform. There are 4 different ways that you can track a student.
Quiz, Fillinblanks, Read the chapter, Watched the video. (Each represents a model)
​
I want to make a model that lets the teacher assign homework for the student. I want to be able to make a model that is different depending on which homework you assign (Quiz, Fillinblanks etc..)
​
So if the teacher wants to assign a quiz and a watched the video for chapter 3.1 I want the model to do two rows. One for the quiz and one for the video, linked with foreign keys to the respective model so you track if the homework is done.
​
Is there an easy way to do this without using 8 tables for all of it. I read up on generic relations but I can't really figure out how to apply that to this situation.
Thanks for any help.
/r/django
https://redd.it/ut15qt
reddit
Different foreignkey by condition in one model
Hi, I have a website that has a student and a teacher side. As a teacher you can track students progress in an elearning platform. There are 4...
Jupyter notebook doesnt show output
so when i use python and try to run a cell more than once once a star (*) appears in the cell number and no output is given. i then have to either delete the cell or create a new file cuz i have no idea how to fix it
/r/JupyterNotebooks
https://redd.it/urrjtp
so when i use python and try to run a cell more than once once a star (*) appears in the cell number and no output is given. i then have to either delete the cell or create a new file cuz i have no idea how to fix it
/r/JupyterNotebooks
https://redd.it/urrjtp
reddit
Jupyter notebook doesnt show output
so when i use python and try to run a cell more than once once a star (\*) appears in the cell number and no output is given. i then have to...
Understanding Flask authentication, authorisation, session management
### What I do?
A `User` model, most important part of my application usually connected to dozens of other models.
> User enters their unique username and password in a form on /register endpoint and submits.
The information submitted by user is recieved at backend.
I hash the password using `bcrypt` and save it in `password_hash` field.
> For /login I match user password hash with the saved hash.
I use Flask-Login which is a "user session management" library according to documentation.
I add @login_required to routes I need user to be authenticated.
### My burning questions
- What is authentication part of this flow and what is authorisation part?
- What is this "flow" called? Traditional...?
- What is Flask-login doing exactly? What happens if I don't use it?
- I am handling login/signup part almost manually, I'd like to do session part too, how does that work?
- My "API endpoints" are where I recieve json data and return jsonify data and it works fine with the same setup. So why do "APIs need different way to auth/auth"?
Is this because "browser is sending the cookie containing session info"?
- What is the right way to do auth/auth in an application which will be accessed by browsers (both template rendered views and endpoints)
/r/flask
https://redd.it/ut2xbs
### What I do?
A `User` model, most important part of my application usually connected to dozens of other models.
> User enters their unique username and password in a form on /register endpoint and submits.
The information submitted by user is recieved at backend.
I hash the password using `bcrypt` and save it in `password_hash` field.
> For /login I match user password hash with the saved hash.
I use Flask-Login which is a "user session management" library according to documentation.
I add @login_required to routes I need user to be authenticated.
### My burning questions
- What is authentication part of this flow and what is authorisation part?
- What is this "flow" called? Traditional...?
- What is Flask-login doing exactly? What happens if I don't use it?
- I am handling login/signup part almost manually, I'd like to do session part too, how does that work?
- My "API endpoints" are where I recieve json data and return jsonify data and it works fine with the same setup. So why do "APIs need different way to auth/auth"?
Is this because "browser is sending the cookie containing session info"?
- What is the right way to do auth/auth in an application which will be accessed by browsers (both template rendered views and endpoints)
/r/flask
https://redd.it/ut2xbs
reddit
Understanding Flask authentication, authorisation, session management
### What I do? A `User` model, most important part of my application usually connected to dozens of other models. > User enters their unique...