The three Model-View-Controller frameworks in this comparison keep their configuration in files. Drupal traditionally takes a different approach in the much of its configuration resides in the database. While this is nice for small sites, it needs special care when setting up a more complex environment, consisting of multiple developers’ seats and staging environments in addition to the live site.
All configuration is done as PHP code in the files in directory app/Config. These are the files that we use:
File in app/Config | Major settings |
---|---|
core.php |
Basics:
|
bootstrap.php | Registration of extensions |
database.php | Database type and credentials |
routes.php | Routes, the connection between URIs and controllers/actions |
Django refers to itself not as a Model-View-Controller framework, but rather as a Model-View-Template framework, i.e. views take the role of controllers and templates that of views in the other frameworks.
Our simple project consists only of a single app (the contents of the projects directory). Generally though, Django projects consist of multiple apps, each with its own set of routes, models, views, templates.
Once a new project is created with the common line tool manage.py, Django uses a single file (projects/settings.py in our case) to configure most of its components and functionality. Routes are kept in a different file though. Optionally, different hosts can be configured for a multi-domain setup. We don’t use this feature, though.
File in projects | Major settings |
---|---|
settings.py |
Basics:
|
urls.py | Routes for our app, mapping regular expressions to views |
admin.py | Settings for the admin interface automatically generated from the models |
Drupal saves its basic configuration in a single file:
File in sites/default | Major settings |
---|---|
settings.php |
Basics
|
Symfony uses multiple locations for its settings:
File | Major settings |
---|---|
composer.json | Versions of all installed bundles |
app/config/config.yml | Configuration of all installed bundles and services |
app/config/parameters.yml | Database credentials |
app/config/security.yml | Configuration of authentication-related services, path-based access control |
app/Kernel.php | Registration of all installed bundles |
Routes can be configured in multiple locations. Symfony mimics Python decorators based on specially formatted comments in the PHP controller files and uses a special preprocessor to extract these so-called annotations to serialized data structures in a cache directory. These annotations allow to specify routes directly at the controllers/actions which is what I use for this project.