Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    proxi
    @void-witch
    so just not sure how to test that the session will be invalidated
    Romario D.R Teixeira
    @romario-drt

    Hi python masters, im django api is giving me this error
    Expected a Response, HttpResponse or HttpStreamingResponse to be returned from the view, but received a <class 'NoneType'>

    my viewSet extends from viewsets.ModelViewSet, I thoug this would generate the general CRUD for me but returns this error.
    Anyone?
    fields:
    queryset = models.Category.objects.all()
    serializer_class = serializers.CategorySerializer

    3 replies
    Ujjwal Biswas
    @ujjwalbe
    Hi
    How to get nested multiple nested table as json results, i tried with select_related but only getting one level deep, any help would be great. I'm new to django
    Falgun Swami
    @swamifalgun
    hello, what’s the right way to filter a model based on a field which uses enum type choices field. thanks
    0legRadchenko
    @0legRadchenko
    Guys, could you please point this out.
    Is it a correct way to write such business logic in django models.py (just get model class from instance)
    def db_marked_as_dr(self):
    __return self.class__.objects.filter(is_db_dr=True)
    or should I just dont bother my head and to simply import model in views and to transfer filtered data like: data= Model.objects.filter(is_db_dr=True) in template through context?
    matrixbot
    @matrixbot
    mowee Hey, ever heard of a library that mocks or simplify unit testing with zip files ?
    FELIX CHERUIYOT
    @felixcheruiyot
    I've built a simple app using Django and https://tailwindcss.com/docs/installation . I love how it is coming along. If interested in the stack please let me know. Check it out https://proofdash.com/
    matrixbot
    @matrixbot
    compsavy hello
    Falgun Swami
    @swamifalgun

    Hi, what is the best approach to handle access token and refreshing them for a django app.
    I want to refresh the access token before it gets expired. I am trying to handle instagram refresh token

    what I have understood is, save access_token and save the expiry date, run cron job once every few weeks, check if the token has expired or about to expire and refresh it via the refresh token and update the access_token.

    please guid me through an approach if this does not sound very optimal to you guys. Thanks

    Aditya Priyadarshi
    @adityapriyadarshi669
    Hello
    Gus Diaz
    @GusDiaz
    @swamifalgun What I do is to check if the token has experied before doing a call to the api and if so then at that moment request a new token. Of course, this could take a few seconds and block your application. In that case you could use the cron job and trigger an automatic update every while you need
    *expired before
    Alex
    @Aktor007
    Hello everyone, I'm looking for versioning with files in Django. New upload file v.1 and after processing the automatic update to v.2. The update from
    version 1 to version 2 should change via upload. I would bee nicet to get some information about this problem.
    thx
    Hossein Fakhari
    @hosseinfakhari
    Hi @Aktor007 , I suggest you to use AWS S3. it's supports file versioning and if you dont want to use AWS, you can use Ceph, it's an self hosting object storage service like S3
    Alex
    @Aktor007
    @hosseinfakhari ... Great !! , thank you for the information. I will try it
    Na'aman Hirschfeld
    @Goldziher

    Hello, I hope this is the right place to ask for this advice.

    I need to allow rest api (DRF) consumers to access on a seperate browser tab (hence I cannot set headers) to connect to a django view, which will redirect them to a 3rd party service, and later be redirected back to the server. I also need to make this secure, and I cannot request login in the nee tab.

    My current solution:

    1. User access a specific api endpoint using token authentication (DRF based), which returns a temporary token. The token is used as a cache key in the server with a short expiry.

    2. Browser opens a new window and sets the URL to the django view with the temp token. If the cache holds a non stale value for the key, the request session is updated with a permanent token (property added to session ).

    This works and I added a few Kore security steps to this scheme, but my problem is that this is not very secure still. Also due to the ingress setup, I cannot record and track client IPS.

    Any advice?

    Sahil
    @imsahil007
    .
    hamzahdili2001
    @hamzahdili2001
    hello guys i'm looking for Team (Web Dev) i'm Work With Python - Django + Flask , JavaScript - Nodejs + React
    Nicolas Couture
    @ncouture
    Howdy
    Yuwin
    @yuwin2020_gitlab
    Hi, I would like to create an form on my website which will include a map(I try with leaflet), when user click on the map in can create an location data and some other field like place name
    I try to find some resource on the Internet, but most of it only shows the example in django admin
    is there some example that I can take as reference? many thanks
    Shashank Parekh
    @sp1rs
    How to check using ps command the number threads for each gunicorn worker running django app?
    Chaitanya
    @ChaitanyaM18
    How can we get a user's current Lat long ?
    Tejas Trivedi
    @tejas-trivedi
    This message was deleted
    Luke-VideoLibre
    @LukeVideo
    Hy all.
    I'm back into Django Dev.
    Sorry for the multiple posts forgot how gitter works. Anyway, I have this chores app I'm building and the first question I have for you guys is how can I make sure an external key in my model won't fail when I create my first instance. So I have chores that have a place field which is an external key, so if I don't create a place first creating the first chore will fail. I have a bitter memory of that issue in my last project. So I saw there is get or create query's. Can I add that in my chores model to add a default place if no place exist's ?
    vaibhavk1985
    @vaibhavk1985
    I have 504 issue with djago
    When I sent 500 request saimulteniosly.I got 504.i have tested with gunicorn, uwsgi and nginx. Because each request create new connections in django
    Please provide me guidenc
    vaibhavk1985
    @vaibhavk1985
    @hamzahdili2001 hello
    I have a python developer. If you need. Pleas
    vaibhavk1985
    @vaibhavk1985
    You contact with me
    Vishesh Mangla
    @XtremeGood
    can someone help fix this? The docs don't explain much here. The password stored is '' despite that random password generation.
    To get a default external key one has to use a function as default. The function is a simple get_or_create query. Seems to get the job done for me 😁
    Trev
    @trevdev:matrix.org
    [m]
    Can anyone refresh my memory about how to serve static files to Django Admin in development? Static is working with collectstatic in prod but I had to reset my settings.py and I forgot what setting I needed for this to work
    Getting 404 errors for the static files
    STATIC_URL = '/static/'
    STATICFILES_DIRS = []
    STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
    SeriousFun01
    @serious_fun:matrix.org
    [m]
    Is anybody familiar with how to "namespace" django management commands so that they are distinct for distinct apps. Haven't been able to find anything even though it seems quite useful. Or is it that people solve this in alternative ways?
    Looking into django code there is a less known feature (appcommand) which i havent quite figured out yet but it doesn't look like a proper namespace
    Blessed
    @nullx5

    @trevdev:matrix.org If you already use collecstatic, Django moves static files from django/contrib/admin/static/admin to the directory indicated by the STATIC_ROOT = os.path.join (BASE_DIR, 'static ') variable in your settings.py

    static
    In production these should be served by an apache or nginx web server.
    To change again use Just set False the variable DEBUG

    vaibhavk1985
    @vaibhavk1985
    I have developed my application in django-rest app for api. I want to handle 10k request concurrently or simultaneous request.
    What will be the aws configuration need
    Which application server will use uwsgi or gunicorn