Oct. 22, 2024

Options for migrating the staticfiles app into core

I performed a recent informal survey on Mastodon about migrating the staticfiles app out of contrib into core. It was generally a positive response with some good questions and considerations to take into account. Today however I want to focus on if the community agreed that this was a good idea, what options do we have available?

Option 1: Move the directory wholesale and update imports to be django.staticfiles instead of django.contrib.staticfiles. This is certainly the easiest change, but one that is instant and a breaking change, which isn't ideal. (Obviously this would be more of a copy/paste scenario that follows the deprecation policy!)

Option 2: Identify the most appropriate home for each section of code within the staticfiles app. If we work through the app, then management commands could be moved into the appropriate directory, similarly with checks, handlers, storage and testing. What is less clear is where urls and views would be located, they are the most normal app blocks of code to exist in the app as they don't easily belong in django.urls, for example, as that module is about housing the code that creates and managed url routing instead of creating actual urls to be used in a project.

Generally I would prefer option two if it were an accepted change as the deprecation would be a smoother ride to my mind, over a big bang change. Do you agree? Is there a third or forth option I've not thought of?