Commit Graph

15 Commits

Author SHA1 Message Date
David Ormsbee
c4f21b6931 fix: remove custom startup to fix dev reloading
The cms/startup.py and lms/startup.py files were created to
allow us to do a lot of custom initialization around things
like the ModuleStore, monkey-patching, adding MIME types to
our process, etc. As far back as 2017, we recognized that
this was a bad thing, marked these modules as "deprecated",
and started removing things or putting them in the standard
Django locations for them (0279181).

In its current state, these startup modules no longer do any
custom work, and just invoke django.startup(). But this is
meant for running Django code in "standalone" usage, e.g. if
you have a script that isn't a management command but needs
some Django functionality.

The "runserver" command used during development normally
launches a child process to serve requests and knows how to
kill and respawn that process when files are modified, so
that changes are reflected. It can also normally handle the
case where there's a SyntaxError in the child process, and
fixing that error will reload the code again.

Something about running django.startup() manually interferes
with this functionality in "runserver". It still reloads the
code in response to changes, but if the code gets into a
broken state for any reason (like a syntax error), the master
process itself dies. That causes the container to restart,
only to die again shortly afterwards in a loop until the
error is fixed. The container restarts will break any shell
you had opened into the container, as well as any IDE
integrations that connected to that container to access the
files and Python instance.

Getting rid of the custom startup code fixes this and moves
us one small step closer to being a more normal Django
project.
2025-02-28 23:16:05 -05:00
Kyle McCormick
25df9ca420 refactor: make safe_lxml an ordinary folder in openedx/core/lib (#25689) 2022-05-24 15:35:23 +05:00
Diana Huang
29548459fa refactor: Remove PyContracts usage. (#27887)
* refactor: Remove PyContracts usage.

We have not used PyContracts in a while and it is overhead we don't
need in edx-platform.

https://openedx.atlassian.net/browse/DEPR-147

* chore: Updating Python Requirements (#28018)

Co-authored-by: edX requirements bot <49161187+edx-requirements-bot@users.noreply.github.com>
2021-06-23 18:24:06 -04:00
usamasadiq
8556d670a2 Applied pylint-amnesty 2021-02-02 15:29:41 +05:00
Kyle McCormick
d21a330d0a Tell isort not to sort certain imports in cms/ 2020-10-19 09:34:31 -04:00
Jeremy Bowman
00adba695c Stop logging deprecation warnings outside devstack (#23742)
The upgrade to Django 2.2 has caused a spike in production logging due to RemovedInDjango30Warning deprecation warnings. For now, turn off logging of DeprecationWarning, ImportWarning, and PendingDeprecationWarning whenever we're using WSGI (they'll continue to be logged in devstack). We may eventually want this behind an easily flipped toggle, but for now just remove it to get this resolved quickly.
2020-04-16 13:54:07 -04:00
Aarif
6ee2089077 fixed warnings for wrong-import-order 2020-04-08 23:43:06 +05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Jeremy Bowman
5ca1a51460 PLAT-1350 Log Python warnings in production 2018-01-29 15:50:13 -05:00
John Eskew
2194d390c8 Remove memory dump signal until meliae packaging issues are resolved. 2017-09-25 10:33:14 -04:00
Calen Pennington
a69c4efd21 Add the ability to send SIGPROF to an edx-platform process to obtain a memory dump 2015-02-02 13:12:58 -05:00
stv
5677b143db Fix PEP8: W391 blank line at end of file 2014-11-10 11:00:18 -08:00
Usman Khalid
32c6dad526 Moved imports to manage.py and wsgi.py. 2014-10-14 18:27:31 +05:00
Calen Pennington
7b81dcc3ea Make split_mongo assert block identity uniqueness only over (block_type, block_id) tuples [LMS-11364] 2014-09-11 09:38:13 -04:00
Calen Pennington
407b02b358 Centralize startup code, and execute in all contexts
Inspired by: http://eldarion.com/blog/2013/02/14/entry-point-hook-django-projects/
Moves startup code to lms.startup and cms.startup, and calls the startup
methods in wsgi.py and manage.py for both projects.
2013-08-27 12:12:20 -04:00