This post has
961 upvotes,
197 downvotes,
and 125 comments!
Credit to u/Krukerfluk and Tom Scott!
Code: https://github.com/CalvinMiller190/reddit-post
This post uses the [praw module](https://praw.readthedocs.io/en/latest/) to get the information about the post, then edits the post every second based on the information that it got!
/r/Python
https://redd.it/iiamfv
961 upvotes,
197 downvotes,
and 125 comments!
Credit to u/Krukerfluk and Tom Scott!
Code: https://github.com/CalvinMiller190/reddit-post
This post uses the [praw module](https://praw.readthedocs.io/en/latest/) to get the information about the post, then edits the post every second based on the information that it got!
/r/Python
https://redd.it/iiamfv
GitHub
CalvinMiller190/reddit-post
Changes reddit post body based on how much upvotes, downvotes, and comments the post has. - CalvinMiller190/reddit-post
Saturday megathread: Share your resources!
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/iiihwe
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/iiihwe
reddit
Saturday megathread: Share your resources!
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...
Is it worthy to use frontend framework like react or vue with Django?
Django comes up with DTL which has enough power to create pretty much everything.
But in the world full of JS frameworks I'd like to know is there any benefit if using javascript frontend frameworks along with Django?
Also give some use cases!
/r/django
https://redd.it/iilow7
Django comes up with DTL which has enough power to create pretty much everything.
But in the world full of JS frameworks I'd like to know is there any benefit if using javascript frontend frameworks along with Django?
Also give some use cases!
/r/django
https://redd.it/iilow7
reddit
Is it worthy to use frontend framework like react or vue with Django?
Django comes up with DTL which has enough power to create pretty much everything. But in the world full of JS frameworks I'd like to know is...
NOT NULL constraint failed: mysite_customer.created_at.
I am getting this NOT NULL error when I try to submit data to my database from a default form ModelForm. My customerform is as follows: Please help!
​
def customerform(request):
if request.method == **'POST'**:
form = CustomerForm([request.POST](https://request.POST))
if form.is\_valid():
created\_at = request.POST.get(**"Created\_at"**, **''**)
name = request.POST.get(**"Name"**, **''**)
address = request.POST.get(**"Address"**, **''**)
Cell\_no = request.POST.get(**"Cell\_no"**, **''**)
*# image = models.ImageField(upload\_to='blog')*
description = request.POST.get(**"Description"**, **''**)
cust\_info= Customer( name = name,address = address,Cell\_no = Cell\_no, description =
description)
cust\_info.save()
return redirect(**'customerform'**)
/r/django
https://redd.it/iipgn9
I am getting this NOT NULL error when I try to submit data to my database from a default form ModelForm. My customerform is as follows: Please help!
​
def customerform(request):
if request.method == **'POST'**:
form = CustomerForm([request.POST](https://request.POST))
if form.is\_valid():
created\_at = request.POST.get(**"Created\_at"**, **''**)
name = request.POST.get(**"Name"**, **''**)
address = request.POST.get(**"Address"**, **''**)
Cell\_no = request.POST.get(**"Cell\_no"**, **''**)
*# image = models.ImageField(upload\_to='blog')*
description = request.POST.get(**"Description"**, **''**)
cust\_info= Customer( name = name,address = address,Cell\_no = Cell\_no, description =
description)
cust\_info.save()
return redirect(**'customerform'**)
/r/django
https://redd.it/iipgn9
Can't access image from media loaction
Hello ,
I configured media location to keep images (like several times already) for a project i am currently working on.
just to add that current project i am using on top of [Django Dashboard AdminLTE](https://github.com/app-generator/django-dashboard-adminlte)
In addition i extended the user properties for user image , when i upload the user related image its loading correctly to the path designated , but when i using in HTML tag to show current user image , don't get anything html tag is
<img src="{ request.user.profile_image.url }" class="img-circle elevation-2" alt="User Image">
When i click show image its seems to follow the correct path but i get error that pic not found
I posted below my [settings.py](https://settings.py) and main [urls.py](https://urls.py) below , i run out of idea
Please advice
Thanks
​
https://preview.redd.it/ih2hbf1drwj51.jpg?width=674&format=pjpg&auto=webp&s=b74440430e9e6602ba254d34c43b87a284ab92f6
the settings file is looks like following
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Static files (CSS, JavaScript, Images)
https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = '/static/'
Extra places for collectstatic to find static files.
STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'core/static'), )
#######################################################
#######################################################
/r/django
https://redd.it/iipg83
Hello ,
I configured media location to keep images (like several times already) for a project i am currently working on.
just to add that current project i am using on top of [Django Dashboard AdminLTE](https://github.com/app-generator/django-dashboard-adminlte)
In addition i extended the user properties for user image , when i upload the user related image its loading correctly to the path designated , but when i using in HTML tag to show current user image , don't get anything html tag is
<img src="{ request.user.profile_image.url }" class="img-circle elevation-2" alt="User Image">
When i click show image its seems to follow the correct path but i get error that pic not found
I posted below my [settings.py](https://settings.py) and main [urls.py](https://urls.py) below , i run out of idea
Please advice
Thanks
​
https://preview.redd.it/ih2hbf1drwj51.jpg?width=674&format=pjpg&auto=webp&s=b74440430e9e6602ba254d34c43b87a284ab92f6
the settings file is looks like following
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Static files (CSS, JavaScript, Images)
https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = '/static/'
Extra places for collectstatic to find static files.
STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'core/static'), )
#######################################################
#######################################################
/r/django
https://redd.it/iipg83
GitHub
GitHub - app-generator/django-adminlte: AdminLTE Django - Open-source seed project | AppSeed
AdminLTE Django - Open-source seed project | AppSeed - GitHub - app-generator/django-adminlte: AdminLTE Django - Open-source seed project | AppSeed
Configure environment-specific settings in Django framework.
Wrote a short blog on implementing environment-specific settings in Django Framework. Hope this will be useful!
[https://thequickblog.com/how-to-configure-environment-specific-settings-in-python-django-framework/](https://thequickblog.com/how-to-configure-environment-specific-settings-in-python-django-framework/)
/r/django
https://redd.it/iip1eq
Wrote a short blog on implementing environment-specific settings in Django Framework. Hope this will be useful!
[https://thequickblog.com/how-to-configure-environment-specific-settings-in-python-django-framework/](https://thequickblog.com/how-to-configure-environment-specific-settings-in-python-django-framework/)
/r/django
https://redd.it/iip1eq
Tasks - is APScheduler better than Cron/Schedule modules?
I want the best one to automate a task, my function makes an API call every 15 minutes and saves data to csv and then calculates that CSV data to show on a chart. What task module would be the best in my case? APScheduler/Cron/Schedule/Celery?
PS: I'll be deploying to Heroku, so I'd appreciate anyone telling me about compatibility issues with Heroku.
/r/flask
https://redd.it/iiu14x
I want the best one to automate a task, my function makes an API call every 15 minutes and saves data to csv and then calculates that CSV data to show on a chart. What task module would be the best in my case? APScheduler/Cron/Schedule/Celery?
PS: I'll be deploying to Heroku, so I'd appreciate anyone telling me about compatibility issues with Heroku.
/r/flask
https://redd.it/iiu14x
reddit
Tasks - is APScheduler better than Cron/Schedule modules?
I want the best one to automate a task, my function makes an API call every 15 minutes and saves data to csv and then calculates that CSV data to...
'users.apps.AppConfig' must supply a name attribute
i am creating a blog with django . i created an app named users . and when i write python [manage.py](https://manage.py) runserver it gives me this eror . how can i fix this? ( i am newbie )
https://preview.redd.it/7k5a6mq60yj51.png?width=1363&format=png&auto=webp&s=b68fe40a64a135d3d451d57a15b37a10d4f96f2d
https://preview.redd.it/q99w71380yj51.png?width=1366&format=png&auto=webp&s=d4bf0a83ace26fd1dd4bc853c4a76d050d50f354
https://preview.redd.it/j9jgc7j80yj51.png?width=1362&format=png&auto=webp&s=f24fede528e7709870437d9c860a48f9f70fdb95
/r/django
https://redd.it/iisbkg
i am creating a blog with django . i created an app named users . and when i write python [manage.py](https://manage.py) runserver it gives me this eror . how can i fix this? ( i am newbie )
https://preview.redd.it/7k5a6mq60yj51.png?width=1363&format=png&auto=webp&s=b68fe40a64a135d3d451d57a15b37a10d4f96f2d
https://preview.redd.it/q99w71380yj51.png?width=1366&format=png&auto=webp&s=d4bf0a83ace26fd1dd4bc853c4a76d050d50f354
https://preview.redd.it/j9jgc7j80yj51.png?width=1362&format=png&auto=webp&s=f24fede528e7709870437d9c860a48f9f70fdb95
/r/django
https://redd.it/iisbkg
[D] Image Decomposition AI - Edit Highlights and Textures Easily
https://youtu.be/sdbMbMKTitM
/r/MachineLearning
https://redd.it/iioqk0
https://youtu.be/sdbMbMKTitM
/r/MachineLearning
https://redd.it/iioqk0
YouTube
Image Decomposition AI - Edit Highlights and Textures Easily [Appearance Eraser]
MATLAB is not free, unfortunately... But it is a great tool if it can be run on any systems easily! Another amazing work from lllyasviel. I sense this can be...
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Why do I get this error sometimes? I even get it when I don't let my computer turn off/sleep or similar.
/r/JupyterNotebooks
https://redd.it/iirl50
Why do I get this error sometimes? I even get it when I don't let my computer turn off/sleep or similar.
/r/JupyterNotebooks
https://redd.it/iirl50
reddit
ConnectionAbortedError: [WinError 10053] An established connection...
Why do I get this error sometimes? I even get it when I don't let my computer turn off/sleep or similar.
Can passing Flask app context to multiple processes lead to problems while performing database operations using Flask-SQLAlchemy?
I am developing a backend which requires some processes to be spawned automatically, and constantly perform database operations from there. I am making use of the Flask SQLAlchemy ORM to interact with the database.
I was able to pass the 'app' variable as an argument to a new process, and perform DB operations from there. But the application requires several such processes to be running at once. Thus, several processes can be making database operations using the Flask app context, in addition to the APIs created inside of Flask itself. Can someone please tell me if this will lead to some sort of a conflict/error?
Thanks in advance!
/r/flask
https://redd.it/iiwc3t
I am developing a backend which requires some processes to be spawned automatically, and constantly perform database operations from there. I am making use of the Flask SQLAlchemy ORM to interact with the database.
I was able to pass the 'app' variable as an argument to a new process, and perform DB operations from there. But the application requires several such processes to be running at once. Thus, several processes can be making database operations using the Flask app context, in addition to the APIs created inside of Flask itself. Can someone please tell me if this will lead to some sort of a conflict/error?
Thanks in advance!
/r/flask
https://redd.it/iiwc3t
reddit
Can passing Flask app context to multiple processes lead to...
I am developing a backend which requires some processes to be spawned automatically, and constantly perform database operations from there. I am...
Long term impact of using UUID as a unique identifier for models
I am developing an app that enables users to post discussion questions and allows other users to react and rate the questions. However, instead of using pk or id to map question urls I'm thinking about creating unique ids for each question using UUID. This is to prevent users from both monitoring site usage and being able to quickly iterate through questions by incrementing id.
So far, I've decided to assign each question on creation a unique id: uuid.uuid4().hex\[:6\].upper(). However, I was wondering the long term effect of this implementation. Every time I create a new object, Django will have to iterate through all existing questions. Will this have a significant computational effect over time? If so, are there any other more efficient implementations of assigning unique ids? Perform some function on the id (but then wouldn't some original issues persist)?
/r/django
https://redd.it/ij0gp3
I am developing an app that enables users to post discussion questions and allows other users to react and rate the questions. However, instead of using pk or id to map question urls I'm thinking about creating unique ids for each question using UUID. This is to prevent users from both monitoring site usage and being able to quickly iterate through questions by incrementing id.
So far, I've decided to assign each question on creation a unique id: uuid.uuid4().hex\[:6\].upper(). However, I was wondering the long term effect of this implementation. Every time I create a new object, Django will have to iterate through all existing questions. Will this have a significant computational effect over time? If so, are there any other more efficient implementations of assigning unique ids? Perform some function on the id (but then wouldn't some original issues persist)?
/r/django
https://redd.it/ij0gp3
reddit
Long term impact of using UUID as a unique identifier for models
I am developing an app that enables users to post discussion questions and allows other users to react and rate the questions. However, instead of...
Sunday megathread: 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/ij317r
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/ij317r
reddit
Sunday megathread: 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...
I’m learning Python, but I also came across my dads old BASIC textbook. The problem solving aspect of the book is almost better than any modern one I’ve read.
/r/Python
https://redd.it/iix2ru
/r/Python
https://redd.it/iix2ru
I made an IMDB webscraper
So this is pretty beginner, but it's my first real project, and today I finished the first version of it. Without going into to much detail, the user pastes a link to IMDB and the program scrapes the shows, gets an average rating for each season, the entire show, creates a graph with the average of each season, and then shows the user IMDB's top 250 rated TV shows and gives them the option to search for a show and see if it's in the top 250. That's pretty simplified and I won't paste all 200+ lines of code but [here is the github](https://github.com/NerdyBread/IMDB-Webscraping) if anyone is interested. I'd love any feedback that anyone has, good or bad.
/r/Python
https://redd.it/iiu17w
So this is pretty beginner, but it's my first real project, and today I finished the first version of it. Without going into to much detail, the user pastes a link to IMDB and the program scrapes the shows, gets an average rating for each season, the entire show, creates a graph with the average of each season, and then shows the user IMDB's top 250 rated TV shows and gives them the option to search for a show and see if it's in the top 250. That's pretty simplified and I won't paste all 200+ lines of code but [here is the github](https://github.com/NerdyBread/IMDB-Webscraping) if anyone is interested. I'd love any feedback that anyone has, good or bad.
/r/Python
https://redd.it/iiu17w
GitHub
NerdyBread/IMDB-Webscraping
Contribute to NerdyBread/IMDB-Webscraping development by creating an account on GitHub.
How to use Django Model Managers? understanding the Django ORM
# Model managers, understanding the Django ORM
[A video in YouTube](https://preview.redd.it/gb9xndstl3k51.png?width=1280&format=png&auto=webp&s=962eb3a6e6e63e9e28d206348e2bd751e7f29171)
​
Hey guys, recently while working on a project I bumped into model managers. I knew they existed but didn't bother to learn more about them. But then I had to work with my own custom user models in Django.
So I plowed through the documentation and learned it all.
I prepared a video for anyone who intends to learn more about them :) Keep Learning!!!
Link to video-
[How to use Django Model Managers?](https://youtu.be/gxeCoRr5zL8)
/r/Python
https://redd.it/ij9dm0
# Model managers, understanding the Django ORM
[A video in YouTube](https://preview.redd.it/gb9xndstl3k51.png?width=1280&format=png&auto=webp&s=962eb3a6e6e63e9e28d206348e2bd751e7f29171)
​
Hey guys, recently while working on a project I bumped into model managers. I knew they existed but didn't bother to learn more about them. But then I had to work with my own custom user models in Django.
So I plowed through the documentation and learned it all.
I prepared a video for anyone who intends to learn more about them :) Keep Learning!!!
Link to video-
[How to use Django Model Managers?](https://youtu.be/gxeCoRr5zL8)
/r/Python
https://redd.it/ij9dm0
How do I optimise my Django project for speed and performance?
Hey guys, hope you are all doing well. I recently deployed a django app to Heroku and it is super slow (5 - 6 seconds on average for a page), in part because I live in India and that's also where the majority of my users are. However, I recently tried shifting my site to AWS Lambda on the Mumbai server, which resulted in RELATIVELY faster load times (2 - 3 seconds for non database pages; pages that fetch stuff from the database are approximately the same if not even slower). This led me to believe that my site may be genuinely slow because the code isn't very efficient. To confirm this, I tested the response times locally using Google Chrome Dev tools. Sure enough, the site pages were taking 1 - 2 seconds on avg. to load locally. For comparison, I also checked the response time locally for a django blog project I had done earlier, and it was around 100 - 200 milliseconds. My current Django app is actually a marketplace, and is a fair bit more complicated than the blog, but it still shouldn't be 10X slower. Any tips on how I can make it faster /
/r/django
https://redd.it/ij6ud0
Hey guys, hope you are all doing well. I recently deployed a django app to Heroku and it is super slow (5 - 6 seconds on average for a page), in part because I live in India and that's also where the majority of my users are. However, I recently tried shifting my site to AWS Lambda on the Mumbai server, which resulted in RELATIVELY faster load times (2 - 3 seconds for non database pages; pages that fetch stuff from the database are approximately the same if not even slower). This led me to believe that my site may be genuinely slow because the code isn't very efficient. To confirm this, I tested the response times locally using Google Chrome Dev tools. Sure enough, the site pages were taking 1 - 2 seconds on avg. to load locally. For comparison, I also checked the response time locally for a django blog project I had done earlier, and it was around 100 - 200 milliseconds. My current Django app is actually a marketplace, and is a fair bit more complicated than the blog, but it still shouldn't be 10X slower. Any tips on how I can make it faster /
/r/django
https://redd.it/ij6ud0
reddit
How do I optimise my Django project for speed and performance?
Hey guys, hope you are all doing well. I recently deployed a django app to Heroku and it is super slow (5 - 6 seconds on average for a page), in...
Python - Date format Part-1
https://www.youtube.com/watch?v=3ZgnxXLqhkg&feature=share
/r/Python
https://redd.it/ij7pny
https://www.youtube.com/watch?v=3ZgnxXLqhkg&feature=share
/r/Python
https://redd.it/ij7pny
YouTube
Python - Date format Part-1
#Python #Python3 #DateFunction #DateInPython #DateFormats
Date function one of the most widely used functions in Python. Python provides the different libraries to find the date and time in different formats. This video deals with the date function in Python…
Date function one of the most widely used functions in Python. Python provides the different libraries to find the date and time in different formats. This video deals with the date function in Python…
How to integrate a machine learning model from Azure?
I built a machine learning model on Azure platform and want to connect it to the web app using Dash(which is built upon Flask) and the model changes continuously with the data. How do I connect the ml model with the web app?
/r/flask
https://redd.it/ij8ai0
I built a machine learning model on Azure platform and want to connect it to the web app using Dash(which is built upon Flask) and the model changes continuously with the data. How do I connect the ml model with the web app?
/r/flask
https://redd.it/ij8ai0
reddit
How to integrate a machine learning model from Azure?
I built a machine learning model on Azure platform and want to connect it to the web app using Dash(which is built upon Flask) and the model...