@SebastianM6L@mastodon.social avatar

SebastianM6L

@SebastianM6L@mastodon.social

Sharing my journey while learning and having fun with #Python and #Django #fullstack development, tech stuff as well as building https://easy-tickets.app on the side.

Also into #gardening, #3dprinting, #homeautomation, #homelab and #devsecops

👨‍👩‍👧‍👦 Dad of 2
👨‍💻 Full time employed (#DeliveryLead / #LeadDeveloper)

This profile is from a federated server and may be incomplete. Browse more on the original instance.

SebastianM6L, to jenkins
@SebastianM6L@mastodon.social avatar

Anyone had an issue with from django.test import Client causing a high memory usage in a docker container?

I run the tests in a pipeline using a #jenkins agent in #docker.

When this test runs:

def test_login_user(self):  
 c = Client()  
 response = c.post('/user/login/', {'email': 'test1@test.de', 'password': 'test123'})  
self.assertEqual(response.status_code, 302)  

The memory usage goes thru the roof. Literally using up all memory until it crashes.

#django #pytest

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@ghickman It seems to happen on the instantiation of client().

It get's even more strange. I just tried and ran the tests with python manage.py test and it went thru.

Seems to be caused somehow by pytest.
django-pytest is installed.

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@ghickman The settings are the same.

The Jenkins agent runs Python 3.12 and this happens with pytest 3.1.1 as well as 3.2.0.

On my MacBook I run Python 3.9 and there is no issue with pytest 3.1.1.

Could it be somehow an issue with python 3.12?

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

Why isn't

Model.objects.get_or_none()

a thing in #django ?

That would save some boilerplate code or am I wrong?

Because if there is a chance that there is no entry for the query get()will raise a DoesNotExist exception that you have to catch.

get_or_none()would be cleaner in my opinion.

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@oliverandrich yeah I kinda don't like the filter().first() approach.

I thought about .get_or_none() method.

That would return you an object only if there is exactly one and return None if not.
Should raise also MultipleExeption if there are more than one object found by the query.

I know it's kind of a special problem. 🤔

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@adamchainz Thanks for the feedback. One of this tickets is mine. I honestly did not search for the closed tickets and thought my idea would be a novelty 🤦‍♂️

I still think it would be useful.

I will start a thread in the forum if there is not already one. Will prepare my example first to make the problem clearer.

Again thanks for your feedback. It's not that easy for first time contributors to manoeuvre around all that.

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

#djangocommunity what is the preferred way of creating data ingestion pipelines in #django?

I have a few systems where I need to invest the data from an curious what ways are preferred or considered as good vs mine 🤣

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@ghickman Thanks for the feedback.
I think I took a similar approach.
At least not to far off.

chrishuck, to 3DPrinting
@chrishuck@fosstodon.org avatar

Was doing a little #practicalprinting yesterday making a new attachment for my shop vac. Ran pretty close to the limit on the spool.

#3dprinting

A spool of black filament on a 3D printer that has nearly run out.

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@chrishuck uuuh that's close. My closest was a few (5-6) windings left.

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

Any #django cracks here who can explain me why when I run my tests with the django built in manage.py test (runs unittest) I have 51 tests run.

When I run them with pytest It will only run 38 tests.

#python #pytest

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@Lleites Thanks. Meanwhile I also realized that.
Have configured the names now in the config.

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@ghickman many thanks. Already figured that out.

theluddite, to random
@theluddite@assemblag.es avatar

theluddite.org is under heavy traffic right now, and I want to take this opportunity to point out how much compute and energy the tech industry wastes.

I host theluddite.org on the absolute smallest linode server available, for $5/month, along with several other websites. It's currently receiving well over 10 requests per second, and has been for many hours.

Here's a graph of the CPU usage hovering at 5%.

#permacomputing

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@theluddite I was recently in a meeting with a vendor to implement a search cluster.
It turned out that everything we needed could fit on a small VPS.

#butitneedstoscale

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

It ain't much, but it comes from ❤️ !

My first contribution to to bump django-filter to 24.2

https://github.com/wagtail/wagtail/pull/11837

SebastianM6L, to python
@SebastianM6L@mastodon.social avatar

OK #python community I have a question.

I like to comment some parts of the code pretty extensively so one can understand the context.

What would be a proper way to break a longer comment apart?

Any other recommendations?

#askfedi #python #django

SebastianM6L, to opensource
@SebastianM6L@mastodon.social avatar

I was just wondering if there is some organization or similar that maybe takes care of #stale #opensource projects like this #django library:

https://github.com/goinnn/django-multiselectfield/issues/141

The developer seems to be inactive for about a year now. And #PR are pending.

What if there would be an organization that would take over those projects and at least take care of the PR's and keep the lights on so they are not abandoned?

Is this already a thing? Or could it be one?

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

#django pros I try to wrap my head around an issue where I need a hint in the right direction.

I have a project where I need to load data into a common data structure. Therefor I have the models where the data has go to.

Unfortunately the data resides in different sources and is not clean. The cleanup has to happen in my django application done manually by a user.

How can I achieve that. Creating a staging table for every source and let the user pick the data that shall be imported? Tools?

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

I'm currently preparing the migration of my #django application from #GoogleCloud to #Hetzner.

So far I had a good experience with Hetzner Cloud.

Setting up a new server is a breeze.

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@danjac currently it's running in GAE and the balancing is done automatically.

With Hetzner I did not figure out yet how I will do it.
One option ist to use nginx as a load balancer but therefore I would need to spin up a predefined amount of containers for the app.
Another way is to run #docker in swarm mode and let docker do the balancing.

Hence I haven't tested neither of the two yet.

Do you have any recommendations?

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@danjac Yes they have. But if you have a look at the configuration options, it seems they are basically just spinning up a nginx for that.

So I safe that money and go with my own nginx container 😂

SebastianM6L, to django
@SebastianM6L@mastodon.social avatar

Where are you hosting your #django applications?

I'm currently running with Google Appe Engine but realized some limitations lately and thinking about to move to a VM instead.

Does anyone have experiance with #hetzner #cloud? Seems pretty solid and reasonable price wise.

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@lcfd Are you running the DB on the same server or are you using different servers for DB and django?
I'm currently thinking about how to set that up.

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@lcfd @danjac Sounds good. Will try to set up a TEST environment with Ansible.
Let's see how far I will come by myself. 😂

e11bits, to django
@e11bits@fosstodon.org avatar

With Heroku's free tier gone, has a clear favorite emerged for free #Django app hosting?

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@e11bits tbh I did not really compare all the possible hosting solutions.
Heroku should be fine.
Maybe you could consider a VM somewhere and use it also for other applications, which would bring the costs down.

realn2s, (edited ) to microsoft

I'm not sure if I get something wrong, but I think #Microsoft #Entra ID #Password Protection is complete rubbish. E.g. when ban weak passwords with the ominous 5 points rule the results seem to be completely arbitrary.

Microsoft speaks of including commonly used weak or compromised passwords in their Global banned password list. But the list isn't based on any external data source, so leaked passwords not leaked by Microsoft are not included 🤡​.

This leads to:
Known leaked passwords are accepted. Location name plus year is accepted. Dictionary word plus year is accepted!!!

Not sure if this applies only to German dictionary words.

It gets even worse. Reading the documentation, I found "Characters not allowed: Unicode characters" WTF

Coming back to the weird point system. A banned password is not really banned, it gives you "only" 1 point (and you need five).

This leads to the question how many points do none-banned words give?

If you think it can't get worse, you're wrong! It looks like each character of a none-banned word gives one point. Meaning "password1234" is an accepted password. (1 point for password and 4 for each digit)

Or a real life example: The #SolarWInds #SupplyChain attach which affected Microsoft, US government agency and countless other organizations world wide, was cause by a weak FTP server password.
Namely "solarwinds123", which would be accepted by #Entra ID #Password Protection (1 point each for "solar" and "wind", 3 points for the numbers. If "solarwinds" would be on the custom banned list, "solarwind1234" would have been enough.

And you can't do anything against it.

I actually hope that the documentation is somewhat wrong and that "123" is not 3 points but 1 as it are consecutive numbers. But this would make it only marginal better (2023

#Cybersecurity #Fail #SecurityFail

SebastianM6L,
@SebastianM6L@mastodon.social avatar

@realn2s
Just this week I had a similar experience, but with seasoned developers.
The company is coding a software for us. One requirement is MFA login, which is standard for all internal and external facing applications.
They invited me for a meeting to clarify some open questions on MFA.
Turned out, they had no clue how it works and where to start. 🙄

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • khanakhh
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • Durango
  • provamag3
  • InstantRegret
  • cubers
  • GTA5RPClips
  • cisconetworking
  • ethstaker
  • osvaldo12
  • modclub
  • normalnudes
  • anitta
  • tester
  • megavids
  • Leos
  • lostlight
  • All magazines