-1

I have a pretty large Django web application. The application is installed on a server and is working. It is divided into several Django apps, each with its own models and views.

The users of this application are also programmers, and sometimes they want to write scripts that manipulate the database. I want them to use the existing Django models.

However, I don't want them touching the big web application, they shouldn't be able to modify the views or write management commands that are installed on the server. Just scripts to run at their own convenience on their own private copy of the database. Ideally, they should be able to just pip install our-django-models.

What's the best way of splitting the application into two parts? One will have to be a very slimmed-down Django application with just the models (which, again, are split into different Django apps). The other will need to be based on the first one, and provide everything else - views, their business logic, settings, etc...

zmbq
  • 38,013
  • 14
  • 101
  • 171

2 Answers2

1

What you describe seems really complex.

I would suggest to use Git (ex: github) and place the entirety of your code in there.

  • Have at least two branches: master[default], dev
  • Everything that will be production ready and will be pushed on your server, can be on the master branch.
  • All your developers can work on the dev branch, or create a branch of their own if they need to do something specific.
John Moutafis
  • 22,254
  • 11
  • 68
  • 112
  • We use a git repository with more than these two branches obviously. I don't see how it helps our current problem. – zmbq May 15 '17 at 10:06
  • Every developer in your team can make a branch to test his individual code, without the need to split up the django project (which seems very complex if possible at all...) – John Moutafis May 15 '17 at 10:13
  • I see. This may actually work, I'll give it some thought. – zmbq May 15 '17 at 10:15
  • Hey @zmbq I was passing through my answers, did you find this answer halpful? – John Moutafis Aug 12 '17 at 14:23
0

You should, maybe, have your django models isolated from the “real domain objects”. You would create a new package, with the domain object logic, and have your django model objects implement both the business objects and the django base class. Then you could implement each method by dispatching to the base class, and provide the necessary django stuff here (limiting its responsibilities to dealing with django only) Both the django team and the other team would be able to pip install our-real-domain-objects