App / Database structure

Hi Guys,

I’m new to this but I’ve hit a bit of a wall. Any advice would be appreciated.

I am building an internal-only website using an Oracle database. I’ve created a Project and 2 Apps; MainApp & FileMgmtApp. Main would be my entry point / index and that will direct users to one of the various Apps where they do the real work. My database is already partly built and contains a dozen or so tables. The FileMgmtApp, so far, uses just one of those Oracle tables.

I have configured the database connection and used inspectdb to build the FileMgmtApp/models.py file. If I makemigrations, then migrate, and configure FileMgmtApp/admin to register the table I can see / maintain the table of interest. This all works well. However, I have some questions about how this should be structured.

When I ran inspectdb, Django didn’t just create a basic model, is also created 2 sets of tables in the database; those with the prefix AUTH, and those with the prefix DJANGO. It also created references to these in the model.py file along with my database application tables.

Couple of questions:

  • Should the AUTH & DJANGO be in a more generic model? Maybe in the MainApp application? They seem to apply to the website generally. Or, if I create further Apps, do these tables turn up in each one’s model.py?
  • Some of my application tables will be specific to an App I have yet to create. Should I remove references to them from this app before continuing?

I would like to kick off with a well-structured project and understanding this will help.

TIA.

You probably shouldn’t have internally-defined models for the auth_ and django_ tables. They’re for internal use by Django and you probably don’t want to mess with them at all. I’d remove them from any models.py file I’m getting from an inspectdb.

Hi Ken,

Thanks for that. I didn’t want to remove them in case I trashed something. I’ll remove them.

Thanks for your time.