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
Django Ecommerce Website with multiple vendors | Part 1

I posted about this series a week ago where I showed a demo of the project and gave a little bit information about it.

Here's some high lightes from part 1:
\-Installation and setup
\-Adding authentication for vendors
\-Making it possible for vendors to add products
\-Making it possible to view products
\-Adding a simple search

If you want to see the demo:
https://www.youtube.com/watch?v=jmc0gV6\_NE0

If you want to see the first part (1 hour and 30 minutes):
https://www.youtube.com/watch?v=FN3EfKC2i6M

Next part will be published soon. Here I will implement the cart functionality and implementing Stripe.

I hope this will be a great project for this community :-)

/r/django
https://redd.it/kzsxy5
RPN calculator in Python

Hey, I just published a project originally developed as solution to some interview challenge (less than 300 SLOC). It is a utility to compute generic expressions in RPN (Reverse Polish Notation).

https://github.com/mohamed--abdel-maksoud/rpn-calc

/r/Python
https://redd.it/l01zd4
Looking for ways to extend my flask API

Hi,

I'm quite new to flask and have built my first API based off of a sample climate Kaggle dataset which basically:

\- Writes a .csv to a PostGRES db using pandas.
\- Exposes that db via get method to replicate a db query.
\- Allows for addition of a new record using a new function in a same repository class as above.

Now, I'm kind of stuck on how to update an existing record, for example a sample newly inserted record, with the id of 8599213. Here is my basic attempt on what I'm trying to do while conserving a model -> query repository -> resource model in place.


Any suggestions are appreciated and thanks for looking!

/r/flask
https://redd.it/l05o7e
Flask Coverage in Background Process

I am working on generating a code coverage report when running cypress tests against a flask server on a Github Action. I have that all working but now I am trying to instrument the server to get code coverage. It works locally but on the Github action I need to run the flask server in the background. When running the Flask server in the back ground it no longer generates a code coverage report.

/r/flask
https://redd.it/l084xj
Coding Julia in Linux. Sometimes one of my cells goes blank.

I am concerned that Jupiter notebooks has become unstable.

Sometimes all of the text in a cell goes blank. Or, it loses all of the Julia colored fonts. If I click it many times it might come back.

If I press CTRL-shift-“-“ like to split a cell then sometimes the cell gets its colour back and I can make that property propagate to other cells by merging into them using “merge cell above”. It has happened two or three times in the last month and it’s a massive heartsink.

It stays if I reboot, and copies from that notebook inherit the problem. So do notebooks if I copy and paste the text into an entirely clean notebook.

It’s enough to be out me off frankly.

What is this? How can I sort it?

It feels like a bug but maybe it’s a missed key stroke.

/r/JupyterNotebooks
https://redd.it/l0691z
Tuesday Daily Thread: Advanced questions

Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.

If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.

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/l07ahg
I made a Twitter bot that is rude to you when you @ it

I wanted to learn a bit more about the Twitter API so I decided to make a bot that is rude/insults you when you @ it or reply to a tweet. I made this as a joke and it is not meant to hurt anybody, just a bit of fun with friends. Sometimes the bot hits the API rate limit so it only replies a couple of minutes later.

I would also like to add that the bot uses swear words, but like I said, it's all for fun.

Twitter: https://twitter.com/rudebot\_

Github: https://github.com/HeyImJ0hn/RudeBot

Feel free to follow it and @ it any time.

​

EDIT: If you have any rude things for my bot to say, shoot me a DM!

EDIT 2: First of all I wanna thank everyone for the support! This is truly amazing! I also wanna say that the bot does repeat itself quite often and I'm trying to improve that.

/r/Python
https://redd.it/l01yqv
Are there any other frameworks that come with a built in admin panel?

Just curious as to whether or not any other framework (python or otherwise) comes with a built in admin panel like Django, I googled but couldn't find anything.

/r/django
https://redd.it/l0ghrh
Django Rest Framework: How to test that methods are not allowed on a specific endpoint?

Hello, I want to test that some specific methods are not allowed on a specific endpoint, for example I want the endpoint to be accessible through GET request but not CREATE, DELETE, UPDATE and PARTIAL\_UPDATE, etc.

This is the way im currently using but it seems a bit too verbose:

class RecipeTestCase(test.APITestCase):
def test_recipe_create_not_allowed(self):
response = self.client.post(self.list_url)
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)

def test_recipe_delete_not_allowed(self):
response = self.client.delete(self.detail_url)
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)

def test_recipe_update_not_allowed(self):
response = self.client.put(self.detail_url)
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)

def test_recipe_partial_update_not_allowed(self):


/r/django
https://redd.it/l0eea1
ML Freelancing Platform Built with Flask

Hey everybody,

I've developed a platform in flask that lets freelancers/contract workers start working immediately on projects. The emphasis is on longer-term work and matches you to a company that needs a project done instantly. It basically guarantees that you get work based on what you're qualified to do, and allows you to spend a lot more time earning and a lot less time searching.

You can get paid/pay on an hourly, fixed price, or retainer model, whatever you currently operate on in whatever currency you prefer.

On the company side, you will find instant qualified matches to fill your hiring needs.

Would anybody be interested in trying it out? I would greatly appreciate any questions/suggestions btw.

/r/flask
https://redd.it/l0si8m
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/l0wtf4
Best cloud hosting service?

Hey guys,
So I wanna deploy my Django backend API but not to production, for development. What is your preferred cloud service to do that?
So I far I found Ngrok and Amazon AWS service, and Jenkins and I’m understanding each one to depth to do a comparison.
I wanna know from your experience, what is your preferred service.

P.S: lately I received very hostile response for my lack of experience and for just trying to help - I hate to see this sub slowly become hostile and aggressive as other websites (apparently just mentioning the names of other websites gets your post deleted).

So please excuse any lack of experience you find in my post (or future posts/comments).

/r/django
https://redd.it/l0znpm
Hacking the DNS protocol to use it as a messaging system

A while ago, I posted about I made a fun POC of hacking the DNS protocol to send messages to a server (creating a communication service relying on DNS requests/replies): https://www.reddit.com/r/Python/comments/jf8zbf/i\_hijacked\_dns\_queries\_to\_send\_messages/

To summarize the idea, the project is using QNAMEs to encapsulte the client messages (encoded in base 32 as a subdomain, for example: encoded-message.dns.server.com), and the server decode the message and sends a DNS TXT reply which content is base 64 encoded.

Well it only worked on the same machine at the time (or when I had luck and had a server binded to my port 53 somehow (to have a port appear as open|filtered, something must be binded to it, and I struggled for a lot of time before understanding why my requests were answered with ICMP type 3 error, port unreachable, when going online)).

Now it's fixed, and what's even better, I can send a DNS TXT request to Googlge (8.8.8.8) about encoded-message.dns.site.com, and since I've registered as my own DNS, everything the other big DNS don't know about will be forwarded... to my server. Thus I can just use the command dig on linux to send messages to my server, from everywhere in the world, which is the

/r/Python
https://redd.it/l0ubhs
Codename Mallow is a 4 player local/online versus multiplayer that I've been coding entirely in Python/Pygame. Somehow my little underdog passion project has earned a berth in the finals for Fan Favorite at the Game Development World Championships! Demo with Source Code available :)

​

Marshmallow Ninja Death Compilation :\)

Codename Mallow is an adrenaline-charged versus multiplayer game with armless melee battles, one-hit-kill weaponry, and wildly unpredictable stages. Duel for Ninja Supremacy with up to 4 friends in local or online play.

2.5 years in the making (so far), Codename Mallow began as an attempt to recreate the feel of DOS cult classic Marshmallow Duel in a more modern package. Feature creep took over, and here we are now on the very brink (Q3 2021) of release! My journey taught me the basics of programming and game development, and I had a blast tackling things like rope physics, particle engines, and even basic socket/threading applications.

I put my game in to the Fan Favorite vote at the GDWC for "what do you have to lose" reasons. I am absolutely thrilled (and shocked!!) to be a finalist among many INCREDIBLY polished indie projects. It honestly feels a little surreal. I shared here a few months ago, and was blown away by the support and positive feedback. Many of you asked me to come back and share a link when my steam page was up, so here we are.

So if this game is your cup of tea, or maybe you

/r/Python
https://redd.it/l0kwfn
Creating a feedback option in Jupyter?

Is anyone here aware of a possibility (an extension) that allows to add some sort of feedback button to a cell in Jupyter Notebooks?

This could be configured by the original author of the notebook and trigger pushing some message to a server where ideally a report would be compiled from multiple messages.

We would love to use such a feature when using Jupyter for education to allow students to communicate their issues immediately with us.

/r/JupyterNotebooks
https://redd.it/l0j6ca
I’m 36 and just starting to learn Python. Is it realistic to think I could get a job in this field by 40?

Hello Python peoples. I’m brand new to all this but I really enjoy it. I don’t know why I waited until this late in life to dig in. Is it too late? Can I actually become proficient within maybe 4 years or so? I make about 50k a year at my current job and can’t go much higher. I recently had a kid and want to earn more. I’d love to do so with programming somehow. Does this path make sense to pursue?

/r/Python
https://redd.it/l18b9m
Making migrations for a dockerized django app

Hey everyone,

I have been trying to setup a django app using this guide:

https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/

And it was a great resource to get everything up and running. However i have problem now when it comes to migrations. Say i add a model, add data into my db, and later i change the model. Now i can run makemigrations using the exec method on the container, but when i shut down my migrations are not stored in my local files i save to my git project, instead they are lost as i spin down the container.

Does anyone know how to solve this, how do you makemigrations is such a setup where you run two dockerized django/postgres dev/prod environments?

/r/django
https://redd.it/l17jih