I want to write a very small Django application in a single file, requiring all the appropriate modules and stuff, and then be able to run that as a normal Python script, li
Well, the easiest way to do that is to mimic the django project arbo in one file. So in one module, assure there is :
Root_module :
Root_module.settings
Root_module.urls
Root_module.app_in_the_module
Root_module.app_in_the_module.models
Root_module.app_in_the_module.views
Then code is as a normal Django project. What you must know is that Django does not need anything to be in a specific place. Standard names and paths are at beat, convention, at worst, shortcut to prevent you from defining a setting.
If you know Django very well, you don't even need to mimic the arbo, just write you django app making all the data from the above modules interconnected the way they should be.