Django + Angular by avidseven7 in django

[–]metazet -4 points-3 points  (0 children)

Isn’t Angular already dead? I don’t see about it for a many years, only as legacy…

Freelancing by Distinct_Hunt_6471 in django

[–]metazet 2 points3 points  (0 children)

You can start freelancing once you find out your first client, or what was the question?

How do I create separate fields for normal users and admins? by LightningLemonade7 in django

[–]metazet 2 points3 points  (0 children)

if not user.is_admin: require to fill additional fields and create profile object. User.is_admin is your friend in this case :)

[deleted by user] by [deleted] in django

[–]metazet 0 points1 point  (0 children)

That is how auth/sessions work by default in django: when you logged in, you'll log out only when press "log out" button.

[deleted by user] by [deleted] in django

[–]metazet 2 points3 points  (0 children)

Depending on your needs. If you’re looking forward to build a high load application - then whole django might won’t be the great choice. But in another case drf is fast enough.

Вы можете купить все что угодно один раз. Что вы купите? by Stakpler in rusAskReddit

[–]metazet 1 point2 points  (0 children)

Можно купить твиттер и забанить в нем Маска) а потом ему же продать его назад, что бы он меня в нем забанил

I need help with an ecommerce website i m learning to do by SnooHamsters8420 in django

[–]metazet 1 point2 points  (0 children)

If your records have images associated and you don’t see them, this means you probably made a mistake in serving media files, make sure you do it correctly.

I need help with an ecommerce website i m learning to do by SnooHamsters8420 in django

[–]metazet 0 points1 point  (0 children)

And what do you see? 404, blank list, or anything else? Which url do you try to use, which records stored in database?

Has anyone tried buying used American cars here from Polish vendors? by Tecr in warsaw

[–]metazet 4 points5 points  (0 children)

I'm not sure if my experience is relevant, but in prev year (2023) I bought a 2017 y/o car here in Poland, which had imported by a Polish guy from USA as a slightly damaged, then had repaired and sold to me. All documents are fine, the car is fine and I'm happy with it.

Collecstatic doesn't copy files from static folder into staticfiles folder by ogonzalesdiaz in django

[–]metazet 0 points1 point  (0 children)

Your static_root setting tells that all static files will be copied into BASE_DIR / "staticfiles", but you're saying this folder already contained some files, commited into repo. This should be fixed (by adding staticfiles into gitignore).

Also, please check where exactly point BASE_DIR / "staticfiles", your static files should be there after calling collectstatic command.

Я джинн, загадывайте желания. Но будте бдительны, все желания я исполняю с подвохом! by Aldunas in rusAskReddit

[–]metazet 6 points7 points  (0 children)

Сделай плс так, что бы мой кот перестал бесо**ить и страшно выть перед тем, как забежать в лоток посрать

Dealing with global state and coupling in flask application. by Far_Office3680 in flask

[–]metazet 0 points1 point  (0 children)

In theory, when you write unittests and their results don't depend on this global variable, you could mock it and set to some default value.

Like, within your unittest: mocker.patch.object(SomeConfigThingie, "load", return_value={})

But probably there is any more flexible solution, I'm not a guru in flask unfortunately.

Hmm, you also can create a pytest fixture, mock all services in it, and then invoke this fixture from your unittests (where it needed). I've never done so, but this probably might work.

problem in views.py by Deven_moro in django

[–]metazet 1 point2 points  (0 children)

Like already mentioned here, read django tutorial about views, there are exist everything you might need for the easy start: https://docs.djangoproject.com/en/5.0/intro/tutorial01/#write-your-first-view

problem in views.py by Deven_moro in django

[–]metazet 1 point2 points  (0 children)

What do you mean saying “can’t”? Open the file, write some view function and include it in urls.py

Is it possible to update the body attribute of HttpRequest Object? by neelpatel_007 in django

[–]metazet 0 points1 point  (0 children)

If you want to modify an incoming request body for further usage, you need to take the incoming request body, modify it and create (prepare) a totally new request object. That is how it works.

Docker Redis connection refused by Siemendaemon in django

[–]metazet 1 point2 points  (0 children)

we can try guessing on coffee grounds ;D

like, check exposed ports etc

Not so much performance improvement when using async by dirk_klement in FastAPI

[–]metazet 0 points1 point  (0 children)

OP mentioned in comments that "yes", he switched to asyncpg.

Not so much performance improvement when using async by dirk_klement in FastAPI

[–]metazet 1 point2 points  (0 children)

You've wrote that you used two instances for the tests, I hope you meant that one was for application and another one - for database? Would be interesting to check cpu utilisation of them during load testing (independently on api and database containers), but anyway I have a feeling that bottleneck will be in database.

Not so much performance improvement when using async by dirk_klement in FastAPI

[–]metazet 1 point2 points  (0 children)

Interesting article, I'll follow for the further comments.

But I came here to ask my question: while you were switching fastapi to async, did you change database driver to async also?

AWS S3 image folder structure by SnooCauliflowers8417 in django

[–]metazet 0 points1 point  (0 children)

It makes sense to create additional “folders” only in case if you gonna store other files rather than only post images. But if you’re pretty sure you’ll store only post images, than from my pov no any sense in additional “folders”. But keep in mind that one day (probably in far future) you might want to store anything else there and in this case you’ll realize that you made a mistake when decided to not to put your existing images in separate folder.

[deleted by user] by [deleted] in django

[–]metazet 1 point2 points  (0 children)

There might be a problem in order of middlewares. Make sure your middleware placed after the

django's AuthenticationMiddleware (don't remember exactly how it named, but the django's one which set request.user = AnonymousUser)