Questions tagged [django]

Django is an open source server-side web application framework, written in Python. It is designed to reduce the effort required to create complex data-driven websites and web applications, with a special focus on less code, no-redundancy and being more explicit than implicit.

Filter by
Sorted by
Tagged with
1
vote
0answers
4 views

Should custom Django Admin be separate from client endpoints?

I am currently in the process of creating a django rest framework project for a client server web app. I would like to ask the following: 1.) Should I write a custom admin if I want my app to be ...
1
vote
0answers
16 views

Use model instance to access model's manager 'objects'

In the Django documentation it's mentioned that Django managers are accessible only via model classes rather than model instances to enforce table and record level operations. What are table and ...
0
votes
2answers
90 views

How should I update non-maintained database tables between production and development?

I'm working on a Django web application (with a mySQL back-end) that uses non-maintained tables(tables not modified by the web app). However, I have two copies of the data tables (one for production ...
0
votes
3answers
148 views

How can we make a UML diagram (or something similar) for a project which doesn't contains classes (like non object oriented)?

I am working on a python project and I didn't use classes but created different modules and added functions in them. Now I need to draw a diagram to describe the project/application for a paper. I ...
0
votes
3answers
106 views

Url pattern for making a 'like' with a REST API

I have an API route as so: GET /api/item/like Which makes a like object between the logged in user and item object, and it works fine. Is this the correct way to have a user 'like' an object? Or ...
1
vote
1answer
28 views

Most readable way of generic views placement

What are your suggestions on placing many generic views? Let's consider a classic situation where I have many generic views for CRUD for given models. What is the best way to place them in views.py? ...
0
votes
0answers
22 views

Implementing multiple session support in a chatbot

I am currently implementing a Chatbot purely in python. In my current implementation, each time the user starts a new chat from a session, another Chatbot instance is launched and hence the Chatbot ...
0
votes
0answers
10 views

When user re-navigates to another page current process is stopped. Nginx-Gunicorn-django

I am using Nginx with gunicorn to host my Django app. In development I used the inbuilt python server to host my django app.(manage.py runserver). One of my definition in views.py inputs multiple apks(...
4
votes
2answers
236 views

Does software architecture depend on framework being used?

When I was building my backend API I used Django combined with django-rest-framework (DRF) because it was the easiest and fastest way to create what I needed. And I haven't thought about an ...
1
vote
1answer
30 views

Django - should I create related objects immediately or on demand?

Let's say you have a ForeignKey MyModel.related_model and this related_model has all fields either null=True or default=something. Like User.userprofile which I use on several places in my project. ...
-2
votes
1answer
55 views

Ways to get up to speed understanding an existing Django program

I have just started a new job in which I will be overhauling and updating a web-application written in Django. I have a loose familiarity with Django (and have been reading up on the documentation for ...
0
votes
0answers
38 views

Which diagram to visualise chain of events (in Django)?

Model situation: In Django (Python web framework), I have a model Event. I need to visualize this chain of events: Everytime new Event is created, confirmation email is generated and sent to Event....
1
vote
0answers
36 views

Is there a Django equivalent to Symfony's services?

Symfony has services, which are separate from controllers so that they may be re-used anywhere. Additionally, Symfony services come with dependency injection. Is there a direct analog to Symfony's ...
1
vote
1answer
46 views

Bulk Inserting Data with Duplicates or Line by Line Insertion Without

I am loading a large amount of data (2,000 files with about 30,000 rows, 30 columns) for use in a Django application. The files are based on 40 different templates. The column names are consistent ...
0
votes
1answer
2k views

Break up django monolith into microservices

We currently have a big Django web application: all data is centrally managed by the webapp, via models backed by Postgres. We want to offer access to the data in a more decentralized way, and the ...
0
votes
1answer
358 views

Django Fat Models: Where should I put model creation logic?

I'm reading Two Scoops of Django 1.11. At 7th chapter it introduces "fat models". It says that best practice is to put a big part of logic into the model and keep views as thin as possible, but then ...
1
vote
1answer
102 views

How can I model unknown and an unknown number of attributes on an object?

My example might be slightly contrived, because I've modified it so that the project isn't recognizable by my employer. I'm a newer developer at a very small company. We have an object - Posts - that ...
-4
votes
1answer
88 views

How do I know a product is in the “will_expire” state? [closed]

I am developing a software system and in it there are time-measured products. The customer buys the product for a period of time, such as one month. If the user does not list their products everyday, ...
1
vote
1answer
360 views

REST API for different User Roles in a SAAS application

Need some help in the desing of the Auth/Permissions of a REST API for a SAAS app. I'd done a prototype of a SAAS app and for permissions of the SAAS client, I'd setup the API to request for a header ...
0
votes
1answer
482 views

Refactor Django application - split monolith into REST API and frontend

I am in the process of refactoring a Django web app. It is written in the usual MVT style, and I would like to change this for a REST + frontend approach. In my first iteration I would like to do as ...
1
vote
1answer
150 views

What are the most effective ways to manage rot in your platform's dependencies?

I have a couple of inactive Pinax sites at different versions (0.9.x and 0.7.x). These both started with two common features: While the version of Pinax was the most recent to have a (nonempty) ...
0
votes
1answer
146 views

Django Project for REST endpoints and client view

I have a project where I will be creating certain data models, and managing them. I also want to provide functionality to external clients to access and modify this database. So the question is around ...
0
votes
2answers
971 views

How to secure web services when authentication is done at client side (frontend)

I have web application which structure is as- webapi : django web services [NOT REST] no security implemented frontend : Angular2. authentication implemented via SAML Database : Mongodb Can you ...
0
votes
1answer
722 views

How is/can front- and backend be separated in Django?

I am evaluating frameworks and I would like to understand Django's architecture better. Coming form a Java background I developed components separately namely front and backend. More concretely ...
3
votes
3answers
325 views

What's the proper way to create a list of several slightly different models?

I'm specifically asking about Django here, but I'd appreciate any insight. I'm currently writing up a basic social network. My plan is to allow users to make different kinds of posts (ie text posts, ...
1
vote
1answer
3k views

Django - separation from the frontend (Templates)

Long story short, let's assume I want to create a webpage that would enable the users to sell used cars. I am a beginner to webdev, so pardon my ignorance. Fun fact: two months ago I knew literally ...
1
vote
3answers
242 views

Django web app: how to save thousands of variables per user

There is a website driven by Django where the user logs in and can answer thousands of questions. I want to persistently save whether a given user has answered a given question or not. My approach so ...
2
votes
1answer
271 views

How do I create front end test data based on backend model's schema?

I'm really struggling with creating robust tests for my frontend because of the coupling in data schema between my backend and frontend. To clarify, I have a Django rest API and I have a front end ...
1
vote
0answers
402 views

How to utilize Fat Models practice for Django and Django Rest Framework

I would like to know how experienced programmers and software engineers balance usage of Django's fat models approach against DRF views. In practice, my experience revolves around configuring DRF ...
0
votes
1answer
223 views

Looking for advice on how to implement Likes

I'm using Django and Django-Rest-Framework to build a simple photo sharing app/website and just now getting around to implementing a "Like" system. A couple of options I've thought about (surely there ...
-1
votes
1answer
105 views

How should I handle an object that has copies of another object?

I really hope this is a good place to ask this since the answers might be subjective, but here it my problem: This is probably irrelevant, but I'm working with Python and Django here. I have the ...
1
vote
0answers
325 views

Suggestions on building an authentication system with Django Rest Framework, Mongo and auth0

I am trying to get some suggestions on how I should architect the authentication system for a Django rest framework API. The stack looks like this: Django REST framework Django REST framework ...
3
votes
2answers
560 views

What is the right time to go for Code Refactoring, not optimization?

I've been working on a Python(Django)/JavaScript(AngularJS) based application for some time now.(I learnt all of these on the way, had previously been a Java only programmer)and have hit moments where ...
1
vote
2answers
496 views

Hardcoding on frontend

I have an API which returns a list of articles. An article can have three status: Approved, Pending and Rejected. Now the front-end needs to hit the API in following scenarios: Get all the articles ...
1
vote
1answer
429 views

Data Transfer Between Loosely Coupled Modules of an Application

Let's say we have a rather large project written in Python using the Django framework that is made up of multiple modules (proper term in Django is a project made up of multiple apps, but for the sake ...
0
votes
2answers
58 views

Filtering Deleted Objects

Picture a simple messaging app written in Django. Users have the option to delete messages at any time, but the messages need to be retained in the database. There are two options: A deleted ...
1
vote
0answers
127 views

Many django projects with one admin for all

I have many django projects witch looks the same: there are some Config models and some models user actions Results. The task is to make a one point of Config models contol, keep the history of ...
0
votes
1answer
463 views

Data filtering & requests: fetch all entries or split data?

I am in a situation I cannot decide which approach is the most optimal (performance wise) while being maintainable at the same time (in the sense of having a clear logic). The question is laid in the ...
3
votes
1answer
493 views

Django: caching properties for non-changing entries

I am wondering if it is a good idea to do the following: I have a Django model (which is related to a migration, therefore it has a database entry) with a bunch of properties. Accessing these are ...
1
vote
0answers
63 views

Best way to handle access to web dashboard displayed on “dumb” screen

My web application has a dashboard page written in angularjs that is intended to be displayed on a screen in a room as a way of monitoring the information therein. It's a dumb screen connected up to ...
-1
votes
1answer
805 views

Is it good approach to collecting all logs in memory of a request and dump once?

What I want to Achieve ? I want to dump all logs in a single line which got collected during a request. Why I am doing this? General approach, i.e. logger.info(), dumps log in file at same time ...
2
votes
1answer
162 views

Django database modelling

I'm starting a project with Django, previously I've used Yii and Rails and they have tools that will take a DB structure and build models for you based off the DB structure. From what I've read Django ...
2
votes
1answer
2k views

Nested imports vs. two separate import statements?

Consider these two styles of code that accomplish the same thing: Nested imports common.models from django.db.models import * class SmallAutoField(fields.AutoField): def db_type(self, ...
0
votes
1answer
77 views

Classes for integrating both BitBucket and GitHub into our site (an inheritance and composition question)

I am writing a system of callbacks for BitBucket and GitHub which should modify our site on certain events in BitBucket or GitHub. It is reasonable to make a base class like GitIntegration to handle ...
0
votes
0answers
37 views

Should I implement an intermediate Profile table now, or wait until if/when I need it?

Traditionally the schema is very simple: User <- Post I have written the code for a Profile model to be an intermediate: User <- ProfileUser -> Profile <- Post When registering for the ...
2
votes
1answer
5k views

Using singletons in Python (Django)

I was suggested to define a singleton in Python in the following way: class Controller: pass # ... controller = Controller() However, this way, controller cannot be replaced with a derived ...
2
votes
2answers
2k views

Fully API-based website - is it a good idea?

I sometimes hear about making web-site fully API based, meaning that even in browser the page is constructed based on API endpoint and practically nothing else. One of the benefits I see in this is ...
2
votes
1answer
311 views

Advantages and disadvantages of building web app purely with microservices and hybrid with web framework

Definition: Purely microservice: Not using any web framework such as Spring, Laravel, Zend, Django. Web app is a single page app loading data via Ajax calls to web services Hybrid: The web framework ...
-1
votes
1answer
3k views

Django and websockets: Channels vs Socket.io vs other?

In my Django web app I want to monitor my remote Raspberry PI clients - up to hundreds - using WebSockets: I have to check in their status in real-time (online, working, offline etc.), send commands ...
1
vote
3answers
608 views

How to detect real time change in API response

I have an API endpoint written for version and health of tomcat applications. It returns a json response with details. I wanted to know, how can i monitor any change in the json response in real time. ...