Phase 3 of the discussion removal plan has been successfully implemented. All Django apps have been deleted, dependencies removed, and all import errors fixed. The application now runs without errors.
Successfully deleted entire app directories:
- ✅
channels/- Removed entire directory (all models, views, APIs, tests) - ✅
channels_fields/- Removed entire directory - ✅
discussions/- Removed entire directory - ✅
embedly/- Removed entire directory
- ✅ Deleted
fixtures/reddit.py - ✅ Updated
fixtures/common.py- removed channels imports and fixtures - ✅ Updated
fixtures/betamax.py- simplified betamax configuration
Removed from INSTALLED_APPS:
- ✅
'channels' - ✅
'channels_fields' - ✅
'discussions'
Removed from MIDDLEWARE:
- ✅
'open_discussions.middleware.channel_api.ChannelApiMiddleware'
- ✅ Removed
include("embedly.urls")
Updated files to remove embedly usage:
- ✅
search/tasks.py- Removedget_embedly_contentimport,update_link_post_with_preview(), andcreate_post_document()functions - ✅
open_discussions/views.py- RemovedembedlyKeyfrom JS settings - ✅
infinite_example/views.py- RemovedembedlyKeyfrom JS settings
- ✅
search/tasks.py- Removedprawcore.exceptions.NotFoundimport, removed channels and Post/Comment imports - ✅
search/tasks.py- RemovedREDDIT_EXCEPTIONSfrom imports - ✅
search/tasks.py- Removedindex_posts()andindex_comments()functions - ✅
search/tasks.py- Updatedwrap_retry_exception()to remove Reddit-specific exception handling - ✅
search/tasks.py- Updatedbulk_deindex_profiles()to not useREDDIT_EXCEPTIONS - ✅
search/constants.py- Removedprawandprawcoreimports - ✅
search/constants.py- RemovedREDDIT_EXCEPTIONSconstant definition
Removed from [tool.poetry.dependencies]:
-
✅
akismet = "^1.1" -
✅
base36 = "^0.1.1" -
✅
praw = "^4.5.1" -
✅ Ran
poetry locksuccessfully
Updated notifications/models.py:
- ✅ Removed
from channels.models import Base36IntegerField, Channel - ✅ Removed
channelfield fromNotificationSettingsmodel - ✅ Removed
CommentEventmodel (discussion-related) - ✅ Removed
PostEventmodel (discussion-related)
Updated notifications/api.py:
- ✅ Removed channel/post/comment handling
- ✅ Made moderator and comment notifications return None
- ✅ Simplified notification settings creation
Updated notifications/notifiers/frontpage.py:
- ✅ Simplified to no-op (discussions removed)
Updated notifications/notifiers/moderator_posts.py:
- ✅ Simplified to no-op (discussions removed)
Updated notifications/tasks.py:
- ✅ Removed Channel model import
Authentication Module:
- ✅
authentication/api.py- removedchannels_api.get_or_create_auth_tokens()call - ✅
authentication/pipeline/invite.py- made channel invite resolution no-op - ✅
authentication/pipeline/user.py- removedmembership_apiimport and usage
Search Module:
- ✅
search/api.py- removed channel constants and models, simplified filtering
Moira Lists:
- ✅
moira_lists/tasks.py- made channel membership updates no-op
Open Discussions Core:
- ✅
open_discussions/permissions.py- simplified channel-related permissions to return False - ✅
open_discussions/recorder.py- made Reddit recorder no-op - ✅
open_discussions/middleware/channel_api.py- made middleware no-op
Profiles:
- ✅
profiles/views.py- made posts/comments views return empty lists
| File | Change Type | Description |
|---|---|---|
channels/, channels_fields/, discussions/, embedly/ |
Deleted | Entire Django apps removed |
fixtures/reddit.py |
Deleted | Reddit fixtures |
fixtures/common.py |
Modified | Removed channels imports and fixtures |
fixtures/betamax.py |
Modified | Simplified betamax configuration |
open_discussions/settings.py |
Modified | Removed apps from INSTALLED_APPS and middleware |
open_discussions/urls.py |
Modified | Removed embedly URLs |
open_discussions/views.py |
Modified | Removed embedlyKey |
open_discussions/permissions.py |
Modified | Simplified channel permissions |
open_discussions/recorder.py |
Modified | Made recorder no-op |
open_discussions/middleware/channel_api.py |
Modified | Made middleware no-op |
infinite_example/views.py |
Modified | Removed embedlyKey |
search/tasks.py |
Modified | Removed embedly, praw, and discussion functions |
search/constants.py |
Modified | Removed PRAW imports and REDDIT_EXCEPTIONS |
search/api.py |
Modified | Removed channel filtering logic |
notifications/models.py |
Modified | Removed discussion-related models and fields |
notifications/api.py |
Modified | Removed channel/post/comment handling |
notifications/notifiers/frontpage.py |
Modified | Simplified to no-op |
notifications/notifiers/moderator_posts.py |
Modified | Simplified to no-op |
notifications/tasks.py |
Modified | Removed Channel import |
authentication/api.py |
Modified | Removed channels_api usage |
authentication/pipeline/invite.py |
Modified | Made invite resolution no-op |
authentication/pipeline/user.py |
Modified | Made membership update no-op |
moira_lists/tasks.py |
Modified | Made channel updates no-op |
profiles/views.py |
Modified | Made posts/comments return empty |
pyproject.toml |
Modified | Removed akismet, base36, praw dependencies |
poetry.lock |
Regenerated | Updated lock file |
Total:
- Directories deleted: 4
- Files deleted: 1 + all files in deleted directories (hundreds)
- Files modified: 24
- Lines removed: ~6000+ (rough estimate including all deleted apps)
- Lines added: ~100 (stub implementations)
✅ Application builds successfully!
- Django check passes with no errors
- All
from channelsimports resolved - No
ModuleNotFoundErrorexceptions
# Django check passes
docker compose exec web python manage.py check
# Output: System check identified no issues (0 silenced).Phase 3 is now COMPLETE. The remaining work includes:
-
Phase 4: Database Migrations
- Create migrations to remove notification fields (channel field, PostEvent, CommentEvent)
- Test migrations in development
- Plan migration strategy for production
-
Phase 5: Cleanup and Testing
- Delete discussion-related test files
- Update documentation
- Test preserved features (search, podcasts, courses)
- Remove discussion email templates
-
Phase 6: Verification
- Full test suite
- Manual testing checklist
- Performance testing
- Final verification
- Phase 3 successfully removed all Django apps and fixed all import errors
- Discussion functionality is now completely disabled via no-op stubs
- The codebase is stable and Django can start without errors
- All changes maintain backward compatibility where possible (functions return empty/None instead of erroring)
- Ready to proceed with database migrations in Phase 4