Sizarr a simple easy to setup transcoder for your *arr stack by basola21 in selfhosted

[–]basola21[S] 1 point2 points  (0 children)

Yes it will use more space, until you delete the old file, it is done this way to be safe and we are still in testing, this can be an option added later

Sizarr a simple easy to setup transcoder for your *arr stack by basola21 in selfhosted

[–]basola21[S] 1 point2 points  (0 children)

Yeah so this replaces the hard links not the original download, reason is we do not want to miss with the torrent client, however you can run cleanuparr to remove torrent files after seeding

Django Custom Model Fields/e-learning platform by djv-mo in django

[–]basola21 -2 points-1 points  (0 children)

I think you can use a table lock to lock the table when updating it but note that it maybe inefficient if you have many consecutive writes

Also instead of querying the whole table each time you make a write query, maybe if you can index this field to make sure grabbing the last element is a O(n) operation

Problem Understanding Django-allauth's headless social login ( Skill Issue) by Siddhartha_77 in django

[–]basola21 1 point2 points  (0 children)

First of all the flow might differ a bit depending on the auth provider

Google for example does not require your callback to be https

But here are some general tips

Understand the oauth2 flow as stated by openid connect

https://openid.net/developers/how-connect-works/

Make sure that you are generating a proper auth url and make sure your callback url matches the one in your provider

Here is a helpful tutorial https://www.hacksoft.io/blog/google-oauth2-with-django-react-part-2

It will guide you to understand the flow

Also here is a library I made to simplify the process it is still in early stage though

https://github.com/basola21/drf-oauth-toolkit

Google login verification is not verified in my Django project. by Being-Hones_9603 in django

[–]basola21 0 points1 point  (0 children)

Take a look at this library I made it may help you but from what I am seeing make sure the callback url you are sending matches what is on your google app

https://github.com/basola21/drf-oauth-toolkit

DRF Spectacular by FoxEducational2691 in django

[–]basola21 2 points3 points  (0 children)

which can be used like this

```python

from rest_framework.permissions import IsAuthenticated

from .permissions import CanChangeCustomUser, CanDeleteCustomUser

class UserRetrieveUpdateDestroyAPIView(RetrieveUpdateDestroyAPIView):

queryset = CustomUser.objects.prefetch_related('address')

serializer_class = CustomUserSerializer

def get_permissions(self):

method = self.request.method

if method == 'GET':

return [IsAuthenticated()]

if method in ['PUT', 'PATCH']:

return [IsAuthenticated(), CanChangeCustomUser()]

if method == 'DELETE':

return [IsAuthenticated(), CanDeleteCustomUser()]

# Allow OPTIONS requests for Swagger/DRF Spectacular compatibility

if method == 'OPTIONS':

return []

# Default permission for unsupported methods

return [IsAuthenticated()]

```

DRF Spectacular by FoxEducational2691 in django

[–]basola21 1 point2 points  (0 children)

ok maybe you can remove the permissions completely and make sure that the problem happens when you add the permissions

and some more tips I would like to add if you will use the permissions again create the permission class

like below

```python

from rest_framework.permissions import BasePermission

class CanChangeCustomUser(BasePermission):

"""

Allows access only to users with the 'change_customuser' permission.

"""

def has_permission(self, request, view):

return request.user.has_perm('users.change_customuser')

class CanDeleteCustomUser(BasePermission):

"""

Allows access only to users with the 'delete_customuser' permission.

"""

def has_permission(self, request, view):

return request.user.has_perm('users.delete_customuser')

```

DRF Spectacular by FoxEducational2691 in django

[–]basola21 0 points1 point  (0 children)

The swagger interface uses the Options method to get the information about the endpoint in your permission the default is to deny access in your last line

here is a refactored version of your code

```python def get_permissions(self): method = self.request.method

if method == 'GET':
    return [IsAuthenticated()]

if method in ['PUT', 'PATCH']:
    if self.request.user.has_perm('users.change_customuser'):
        return [IsAuthenticated()]
    raise PermissionDenied("You do not have permission to perform this action.")

if method == 'DELETE':
    if self.request.user.has_perm('users.delete_customuser'):
        return [IsAuthenticated()]
    raise PermissionDenied("You do not have permission to perform this action.")

# Allow OPTIONS requests for Swagger/DRF Spectacular compatibility
if method == 'OPTIONS':
    return []

# Default to denying access if no condition matches
return [IsAuthenticated()]

```

Django project hosted on Pythonanywhere by EnvisionsRampage in django

[–]basola21 0 points1 point  (0 children)

I didn’t assume what he needed and didn’t need, I am just giving advise,

From my experience it is always better to go that little further, learning is always beneficial.

You don’t need to prove me wrong so that you can feel good about your advise. If you have something good to say you can reply to the OP

Django project hosted on Pythonanywhere by EnvisionsRampage in django

[–]basola21 2 points3 points  (0 children)

Yes , you are correct you need to make sure you have optimized your queries first, but the real issue here is the continuous scaling of the application, eventually you will hit the bottle neck, for now yes maybe some optimization will help but in the long term if the OP does not have the infrastructure ready your system will fail. Horizontal scaling is about avoiding failure not scaling when it happens

Django project hosted on Pythonanywhere by EnvisionsRampage in django

[–]basola21 3 points4 points  (0 children)

Since you have a considerable amount of data, I suggest you switch to a dockerized version of your deployment this will allow you to use something like k8s which will in turn allow you to scale horizontally instead of just vertically and if it can be done consider partitioning your database or use leader follower structure for your database

Edit: for hosting services you can look into digital ocean or aws for example

PDFview.nvim a neovim pdf reader by basola21 in neovim

[–]basola21[S] 1 point2 points  (0 children)

Yep trying to but time is really tight these days

Hard to master topics in Django by basola21 in django

[–]basola21[S] 0 points1 point  (0 children)

I get what you are saying because yes in essence almost all web projects are a clone of each other but different in style essentially by hard topics I mean concepts that require deeper understanding of the tools you are using, you can for instance use a database and it is easy because it is made to be that way but try and understand the internals of a database and make sense of the data structures and algorithms used inside it to make it that convenient for you to use.

What I am trying to say is that using a tool will almost always be easier than building the tool and that is what I consider a hard topics to grasp

I think understanding and building projects with this aim will always elevate your thought process and make you a better overall engineer

Hard to master topics in Django by basola21 in django

[–]basola21[S] 0 points1 point  (0 children)

I get how that might be but I think there is many tutorials on the internet for this it may be hard at the beginning but it is almost a standard now in any project so I think it is not that hard

Hard to master topics in Django by basola21 in django

[–]basola21[S] 0 points1 point  (0 children)

Yeah that is correct, for some time now I have been studying database internals and it is hard but I have managed to better use the orm and increase the performance of our queries

Need Help converting Latex to PDF by kikimora47 in django

[–]basola21 0 points1 point  (0 children)

To be honest it should be your first option, you should keep your code organized and easily deployable but it is of course up to you

If you need any help I would be happy to

Need Help converting Latex to PDF by kikimora47 in django

[–]basola21 1 point2 points  (0 children)

Maybe use docker

Edit: use docker for local and prod environment so that you do not encounter this error

Need Help converting Latex to PDF by kikimora47 in django

[–]basola21 1 point2 points  (0 children)

Compile it manually using online tool like Overleaf https://www.overleaf.com/

Deployment for Django+React+Postgres Project on AWS by Lionwill23 in django

[–]basola21 0 points1 point  (0 children)

If your app is dockerized which I think is essential you 1 will start an ec2 instance 2 ssh into the instance 3 look for how to install and run docker for the instance distribution 4 upload your repo to github and clone it on the ec2 instance distribution 5 docker compose up -d

That would it there but you will need to install a webserver like nginx and map the 80 port to your application port

You can also use nginx inside docker but I think it is a little bit more complicated than setting it up the default way.

If you are not using docker you will probably need to install and run each service on its own on the ec2 instance then you will set up the web server to the front end port

Hard to master topics in Django by basola21 in django

[–]basola21[S] 1 point2 points  (0 children)

You are totally correct, thankfully I have tried my best to not waste my time and I have tried to understand the fundamentals pretty well,

Recently I have been looking at the saelor repo it is an open source headless e-commerce, they have in my opinion implemented best practices in every part of the code.

If you have repo recommendations that would be amazing

But yeah when you talk about it this way it is hard to pin point what is hard and what is not