Question

I have a theoretical question about how integrate django with others subsystems not web oriented. I don't know if it is possible develop this class of systems with django or if there are another best alternative (another web framework).

I propose a possible system with this requirements and the structure that I would develop.

For example:

  • A not web platform whose main purpose is perform hard calculations in the background and saves the results in a DB.
  • Two interfaces for manage these services in background: a command line interface and a web interface (with django or another web framework)

My idea for this architecture is as follows:

project_dir
| --- __init__.py
| --- main_system (eg: calculus, task in background, daemons...)
_____| --- __init__.py
_____| --- modules of this subsystem
| --- data_and_persistence
_____| --- __init__.py
_____| --- models (ORMs, SQL, ad hoc solutions,...)
| --- common_modules
_____| --- __init__.py
_____| --- auxiliar common modules
| --- command_line_interface
_____| --- __init__.py
_____| --- command_line_interface_modules
| --- web_interface
_____| --- __init__.py
_____| --- django project here
| --- test
_____| --- __init__.py
_____| --- test of all susbsystems

There are the following layers (summarized):

  • Persistence layer: manage database models.
  • A common business logic shared between both interfaces and the main_system.
  • I/O subsystems: task in background, command line interface and web interface.

I have found some problems with this solution:

  • Django modules are hard coupled and they are very dependent of the settings file, environ path... (eg: use django orm in main_system).
  • I haven't found a good way to test the whole platform. Unittest with discovery and nose have problems creating the database for tests. django-nose depends on django (but I need to test another systems independent of it). Are there a good way to execute all unit and integration test with a simple command?

What things would you change? How would you do it?

Regards

Was it helpful?

Solution

It sounds like a Django/Celery combination would satisfy your requirements (except for the one that says you don't want to use Django).

  • Django provides you with the ability to create custom actions off of the command line.
  • Django provides you with the web interface.
  • Celery allows you to do the hard calculations asynchronously.
  • You'll be able to use the Django ORM so you don't have multiple model definitions.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top