Commit Graph

20 Commits

Author SHA1 Message Date
Tim Abbott ec9f6702d8 manage.py: Sabotage importing pika.adapters.twisted_connection.
This is a performance optimization; see the comment.  This fixes part
of #9953.

Eventually, we should do the same thing for importing Tornado as well,
but it's less important because Tornado is a much smaller library.
2018-10-17 11:50:08 -07:00
Tim Abbott d49cee3050 manage.py: Catch issue with users running manage.py as the wrong user.
Apparently, if you tried running manage.py as a non-root user that
isn't the main zulip user, you'll get a confusing Django exception
about `SECRET_KEY` not being configured.

This change provides a clean, understandable exception for this case.
2018-07-30 12:34:48 -07:00
rht a603a4f9f5 Remove `from __future__ import absolute_import`.
Except in:
- docs/writing-bots-guide.md, because bots are supposed to be Python 2
  compatible
- puppet/zulip_ops/files/zulip-ec2-configure-interfaces, because this
  script is still on python2.7
- tools/lint
- tools/linter_lib
- tools/lister.py

For the latter two, because they might be yanked away to a separate repo
for general use with other FLOSS projects.
2017-10-17 22:59:42 -07:00
rht c2290b0328 Remove the rest of print_function. 2017-09-27 18:06:47 -07:00
Greg Price 598acd1f34 manage.py: Clean up imports a bit.
Import at fewer separate places in the code, and without duplication.
2017-08-20 22:37:38 -07:00
Greg Price f73e898874 manage.py: Save an extra Django startup by converting one script to a library.
This saves us from spending 200-250ms of CPU time importing Django
again just to log that we're running a management command.  On
`scripts/restart-server`, this saves us from one thundering herd of
Django startups when all the queue workers are restarted; but there's
still the Django startup for the `manage.py` process itself for each
worker, so on a machine with e.g. 2 (virtual) cores the restart is
still painful.
2017-08-20 22:37:38 -07:00
Greg Price a099e698e2 py3: Switch almost all shebang lines to use `python3`.
This causes `upgrade-zulip-from-git`, as well as a no-option run of
`tools/build-release-tarball`, to produce a Zulip install running
Python 3, rather than Python 2.  In particular this means that the
virtualenv we create, in which all application code runs, is Python 3.

One shebang line, on `zulip-ec2-configure-interfaces`, explicitly
keeps Python 2, and at least one external ops script, `wal-e`, also
still runs on Python 2.  See discussion on the respective previous
commits that made those explicit.  There may also be some other
third-party scripts we use, outside of this source tree and running
outside our virtualenv, that still run on Python 2.
2017-08-16 17:54:43 -07:00
Tim Abbott a9d52052f0 manage.py: Print CommandError exceptions cleanly.
Django, by default, prints these exceptions as a giant traceback,
which is really ugly and scary to sysadmins.  We really just want to
print the error message to stdout for convenient viewing by the user.
2017-07-07 13:44:14 -07:00
Tim Abbott 21f09dcab7 docs: Make it harder to screw up our manage.py commands. 2017-02-03 12:57:50 -08:00
Eklavya Sharma a9835c0ab2 Activate virtualenv in production Python code.
The manage.py change effectively switches the Zulip production server
to use the virtualenv, since all of our supervisord commands for the
various Python services go through manage.py.

Additionally, this migrates the production scripts and Nagios plugins
to use the virtualenv as well.
2016-06-27 19:55:35 -07:00
Eklavya Sharma 149938d468 Change shebangs from python2.7 to python. 2016-05-29 05:03:08 -07:00
Tim Abbott a315849a9e Move bin/log-management-command to scripts/lib/.
We're in the process of eliminating the bin/ subdirectory in favor of
the scripts/ tree, and this one isn't user-facing.
2016-05-07 19:37:06 -07:00
Tim Abbott f9222de83e Auto-load commonly used modules in manage.py shell.
This automatically loads settings, zerver.models.* and
zerver.lib.actions.* when you start `manage.py shell`, which should
save a bit of time basically every time someone uses it.

Fixes #275.
2016-03-19 11:32:49 -07:00
Steven Oud d5435fad1d Consistently use /usr/bin/env python2.7 in shebangs and commands. 2015-10-21 22:58:21 +00:00
Raphael ea65715ef8 manage.py: Give a nice error message if run as root on posix systems.
If the os is posix, this will check to see if the user is root and
alert them to run as zulip user if so.

Fixes #114.
2015-10-05 21:41:35 -04:00
Tim Abbott 6c7489ed88 logging: Log management commands that are run.
This could potentially help with debugging exactly what happened with
some issue down the line.

(imported from commit cc7321d742875b644d4727a084b462dcd01dcf10)
2013-11-20 14:31:08 -05:00
Tim Abbott 7b9305b06f Rename Django project to zproject.
This includes a hack to preserve humbug/backends.py as a symlink, so
that we don't need to regenerate all our old sessions.

(imported from commit b7918988b31c71ec01bbdc270db7017d4069221d)
2013-08-07 11:04:03 -04:00
acrefoot aedb81c490 Make manage.py spit out tracebacks, without a patched django
I first made --traceback the default in my patches to django, but this
broke several regressions tests (when Luke built .deb packages), so he reverted that change,
and I'm putting this default into our manage.py instead

(imported from commit 460253561e637d8a6692c68bbd3859f266dbf83d)
2013-05-28 19:05:06 -04:00
Keegan McAllister a130dfb1fb chmod +x manage.py
So you can write "./manage.py" instead of "python manage.py".

(imported from commit 9d00e17195d6c849611f2a0fa6f8927d3410cc2a)
2012-10-25 15:22:18 -04:00
Jessica McKellar 67212f2e7a Add manage.py (oops).
(imported from commit ee314b56312527adcd13e08cd515c3e643cfee2e)
2012-08-28 12:45:35 -04:00