a Python web framework
0
votes
0answers
24 views
What is better for API, written with DRF - dedicated serializer or overriding “get_fields()”? [closed]
Now I write application with Django and Django REST Framework. I will do not show all model fields for users with restrited access, for example, field "moderated" for comments model, but admin and ...
1
vote
2answers
149 views
How do I prevent people from abusing my endpoint that accepts files? [duplicate]
So I have a Django app hosted on Heroku that has an endpoint which accepts image uploads. The images are saved to my AWS bucket, which is charged to me. Right now, I am able to upload images by making ...
1
vote
0answers
29 views
the right way to generate my Django model/db_table
I went through the Django tutorial with in mind to go through it again using it to set up my small app.
So now I am making a simple app where users can search a large set of strings and get a subset ...
2
votes
1answer
87 views
Multiple different versions of similar apps in one project
I need some help to improve the architecture of a site I've built. What I want to achieve within a single Django project is the following:
I want a site that comes in several versions (one per ...
0
votes
0answers
61 views
Server-Side MVCs vs Client Side MVCs
Recently I was asked to do a project as a technical assessment. The assignment is to create a website using Twitters API. The assessment recommended using Django. When I quickly looked up Django I ...
1
vote
0answers
35 views
Django API design
I recently followed the Django API tutorial.
http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/
When I initiate a POST request my intent is that after inserting the record into ...
2
votes
1answer
70 views
what the best practice in REST to append or delete to a list
Suppose
GET /users/<id>
{
user_id : "asdasdas-da-sd-asd-as-d",
firs_name : "asdasd",
....
department : [{
id : "asdas-da-sdasd-asd",
name : "asdasdasdasd",
...
...
0
votes
1answer
132 views
Django urls.py runs only once. Why? How does it call views on next request?
While testing django cashing on our development server, one of our senior asked if is it possible to change the value of caching timeout on urls.py without restarting the http service.
On first note, ...
2
votes
1answer
72 views
Is it good practise to have the class name as a prefix in Django model?
I wrote a model in this format in Django:
class Block(models.Model):
block_id = models.AutoField(primary_key=True)
block_name = models.CharField(max_length=200)
block_code = ...
0
votes
1answer
55 views
How Do I Securely Edit a Database Entry Based On ID in an Admin System?
This is more of a conceptual question because the way that I am doing it would be secure enough for my purposes (educational). I created a simple admin panel that displays a stock picks database as ...
3
votes
1answer
69 views
How to handle Django get-single-instance-in-view pattern?
A lot of my Django views start a little bit like this:
try:
# here request.POST could also be request.GET or a captured URL parameter
MyModel.objects.get(user = request.user, some_attr = ...
0
votes
1answer
66 views
How to API design architecture for long delay process
Im trying to start an API design using Django Rest Framework, and the problem Im trying to solve is the following:
Request endpoint is like this:
POST
http://server:8080/api/v1/device
attribute: ...
3
votes
1answer
168 views
Separating Django models for SOA
First of all, the goal of this exercise is to create a SOA with Django.
I am trying to understand what the implications would be if I decided to separate and insulate models into apps, provide a REST ...
0
votes
1answer
49 views
Should I have all models done before I syncdb?
I'm not sure if I want to add more attributes to my models or create another model. I've coded up to the point where I need to syncdb to start using some data in the site, but I'm hesitant to do it. ...
2
votes
0answers
169 views
Separating AngularJs and Django into individual Apps?
I am building a web application using AngularJs and our web server is built in Python Django Rest Framework.
I would like to have the two projects separated and not coupled.
In my current setup the ...
1
vote
1answer
236 views
How would a modern website like Reddit divide up its website into Django apps? [closed]
Django uses apps to divide projects into manageable and reusable chunks. All examples in tutorials use polls or articles in unrelatable circumstances. In a modern example like Reddit (or even Amazon ...
1
vote
0answers
232 views
How can I use protected Tastypie resources within Angular?
I have a working Django 1.7 project with an API (Tastypie) made available for mobile clients (ApiKeyAuthentication).
I am using Angular with Chart.js, and so I need to GET some queryset using ...
2
votes
0answers
69 views
Scoring algorithm implementation with Django and Redis
I use DjangoREST & MySQL as a backend for a mobiel app. I have two models, User and Feed and for any call to api/feeds/ returns all feeds for authenticated user ordered by created_at parameter of ...
0
votes
1answer
48 views
Django Project Logic Solution
I'm starting to develop my first webapp, and I'm using django.
Before anything I'm working on the software logic, how it should work, the links and objects it needs.
The problem is:
I need the app ...
1
vote
0answers
103 views
Django Project with Multiple Apps on Heroku
A newbie question:
I've been able to deploy a few simple Django apps on Heroku very easily.
However, now I am tackling a much larger project that consists of several apps (all Django and all with ...
1
vote
2answers
151 views
How to handle configuration of Python modules, especially when used standalone and in frameworks like Django
I am trying to package a Python module for pip, following the guide here.
One area I would like feedback on is best practices or convention for making my module configurable. The module is a library ...
0
votes
1answer
77 views
How to implement a RESTful API that updates a list which might have exclusion and addition of related resources?
We have an application where there is an API to create a document with a POST and update it with a PUT. There is a separate API to share document with users.
Now, How should we approach updating the ...
-1
votes
1answer
197 views
Using a REST API for both mobile and web [closed]
I've always only used REST to build web services for mobile apps, for example i use Django to build the website using templates, and build a REST API using django framework, but would it be a good ...
0
votes
1answer
69 views
Sessions in cloud applications dangerous?
We have a django app hosted on heroku. I had a situation:
A user entered an email in a form on page1. If the email existed in
the database he was redirected to Login page otherwise to register
...
0
votes
1answer
145 views
Repurpose MySQL as a mutex
My application needs to perform an operation once every 10 minutes, but that operation is triggered many times more frequently. Occasionally it is triggered three or four times a second in different ...
4
votes
2answers
383 views
How to layer if statements when order of logic is irrelevant?
Basically I have a series of logic in my website that can lead to 5 total outcomes. Basically two different if tests and then a catch all else statement.
For example:
if cond1:
if mod1:
...
2
votes
1answer
462 views
What is the Controller in Django MVC?
Learning Django MVC and the way I thought of it is:
Models are the database tables represented in Django as Python classes.
Views are the HTML returned from function in views.py.
Controllers are the ...
2
votes
2answers
443 views
Django CBVs vs FBVs
For creating a large Django project with many apps, my first initial thought was to used Class Based Views (as the Django tutorials seem to emphasize). However, I noticed that due to a lot of the ...
0
votes
1answer
1k views
Javascript function should call python logic in django web development without additional triiger
I have been trying to solve this problem for sometime now. This is regarding django web development.
I have an HTML page which has a Javascript function to upload an image file from the users local ...
1
vote
1answer
229 views
Outsourcing functionality from Django view to C/C++
I'm developing a Django project that basically boils down to:
A user submits a form.
The Django view parses the form and compiles a representation of that form which is readable by some other ...
5
votes
2answers
1k views
where exactly should python business logic be placed in django
I have just begun to learn Django/Python/Web Development. This problem has been troubling me for a while now.
I am creating an application with multiple templates in Django. I have a views.py which ...
1
vote
1answer
118 views
Add arguments to mysql in Django's “dbshell”
I'd like to add a couple of command-line arguments to my Django's ./manage.py dbshell command, and I can't figure out how.
In specific I'd like to add -A to prevent MySQL from scanning every table ...
1
vote
2answers
166 views
Is it ok to start with templates in MVC development?
I'm new to web development and I've started working on a project in my company that uses DJANGO. I feel it flexible to start my development straight first from the templates. I think it will be easier ...
3
votes
3answers
126 views
Should custom data elements be stored as XML or database entries?
There are a ton of questions like this, but they are mostly very generalized, so I'd like to get some views on my specific usage.
General:
I'm building a new project on my own in Django. It's focus ...
1
vote
1answer
538 views
Storing primary keys of objects in Redis and then querying them in Postgres through Django
This is probably my second time posting in programmers. I'm usually on stackoverflow but this question is more fit for the community here.
All suggestions, advice and insight on this matter is ...
1
vote
1answer
473 views
How do you handle domain logic that spans multiple model objects in an ORM?
So I know that business logic should be placed in the model. But using an ORM it is not as clear where I should place code that handles multiple objects.
E.g. let's say we have a Customer model which ...
32
votes
4answers
10k views
Is backing up a MySQL database in Git a good idea?
I am trying to improve the backup situation for my application. I have a Django application and MySQL database. I read an article suggesting backing up the database in Git.
On the one hand I like ...
9
votes
3answers
319 views
Storing editable site content?
We have a Django-based website for which we wanted to make some of the content (text, and business logic such as pricing plans) easily editable in-house, and so we decided to store it outside the ...
4
votes
2answers
193 views
Unit Testing: How much more code? [duplicate]
I'm fairly new to unit testing. In school it's always been, "hey it works, onward!" But I've started to write professionally, and even at work that's been basically the mantra. However, I've started ...
2
votes
1answer
63 views
Using Django to Create Child Sites
I am creating a series of small sites, I'm using the django framework. The theory goes a user comes to a master site, signs up, then he gets his own child site.
Example:
navigate to example.com
...
5
votes
2answers
3k views
Decoupling Server and Client using REST API
I was thinking about how I can decouple a web-application completely into a server-side and a client-side component. I want to decouple the app to the extent that I can host both components on ...
5
votes
4answers
1k views
Front-end structure of large scale Django project
Few days ago, I started to work in new company. Before me, all front-end and backend code was written by one man.
As you know, Django app contains two main directories for front-end: /static - for ...
0
votes
2answers
306 views
How can I convince my client that the task was complex and the time I took is fair?
I am the single programmer working on a website handling both frontend and backend. Recently in my task list I have to provide a social news feed (activities among friends) which should summarize ...
1
vote
2answers
681 views
Using a web framework as python GUI
If I built some useful piece of python code to e.g. scrape a website or to calculate something big, at some point I might want to add a GUI to my project. For this I could use Tk, Qt, Pygame or any ...
3
votes
1answer
2k views
Database design/relationship for threading messages
What's the database design or business logic for creating an app for messaging between users?
I am having difficulties with choosing how to approach the relationship between each Conversation of User ...
0
votes
2answers
437 views
What could be the Model Layer when consuming Web-Services and no Database in Django?
I'm using Django as an application framework and it only needs to consume web services (no need to have traditional Django Models and the related ORM).
In this case, since Django is a variant on the ...
2
votes
3answers
3k views
REST API at backend and MVC Javascript framework at client side
I am building an online social network. I have finished writing RESTful API service using Django. This will return only JSON response (No HTML will be generated from server side) so that this JSON ...
2
votes
1answer
395 views
Merge two different API calls into One
I have two different apps in my django project. One is "comment" and an other one is "files". A comment might save some file attached to it.
The current way of creating a comment with attachments is ...
1
vote
2answers
2k views
Django REST + Backbone/Ember/Angular Implementation Method
http://stackoverflow.com/questions/10941249/separate-rest-json-api-server-and-client
In light of this post, I wanted to ask questions regarding Django and specifically the implementation methods of ...
1
vote
1answer
327 views
Architecture design for a web application that runs SSH connections to remote servers
This is a followup to my question here.
I have to make a web GUI for a library that manages remote clusters via SSH.
The main point is that this library spawns threads and subprocesses (Popen) ...