136 Commits

Author SHA1 Message Date
Nick Stenning
b135c0570f Respect defaults when running a paster application
The values of both the 'workers' and 'umask' settings have global
defaults. In the case of 'workers', this global default can be
overridden by the WEB_CONCURRENCY environment variable, which prior to
this commit is ignored by `gunicorn --paste`.

Removing this duplication of defaults allows `gunicorn --paste` to
respect settings from:

- the environment (WEB_CONCURRENCY)
- the paste configuration file
- CLI flags
2015-10-15 14:10:49 +02:00
Slava Shklyaev
531133615e Prefix config file with its type 2015-07-08 09:21:32 +03:00
Randall Leeds
1b0901d661 Set logconfig default to paster more trivially
Rather than using fileConfig twice and risking different defaults
and behavior around disable_existing_loggers (ref #902), simply
set the default logging config file to be the paster config file
if it has a logger section and let glogging set up the rest.
2014-11-19 15:26:26 -08:00
Collin Anderson
f2ba62bc10 six 1.8.0 and gunicorn._compat
closes #904 and #905
2014-10-02 17:00:03 -04:00
Collin Anderson
bfae0c91de sys.stderr.write -> print(msg, file=sys.stderr) 2014-09-16 15:38:56 -04:00
Collin Anderson
0d3045bb41 cleaned some code 2014-09-10 20:34:22 -04:00
Ben Phillips
6e2de5ab6e Tidy up comments 2014-08-19 07:48:31 +01:00
Benoit Chesneau
7bb1a57815 Merge pull request #809 from berkerpeksag/set-logging-paste
Set global logging configuration from a Paste config.
2014-07-26 11:24:01 +02:00
Stéphane Wirtel
2e8db50989 We need at least one argument for the WSGIApplication fix #815 2014-07-25 10:25:56 +02:00
Berker Peksag
b6d445a5a1 Set global logging configuration from a Paste config.
Since gunicorn.app.pasterapp.{run, paste_server} are deprecated,
there is no way to configure the logging module from a Paste config
file.
2014-06-29 04:08:37 +03:00
benoitc
46afb979e2 Revert "swicth confing load order"
This reverts commit b5aab16bf590cacff1825410d9cfaea925de5b24.

Change was broken. If we simply switch there, the error when loading the
config will not be reported correctly. We should find a better way.
2014-06-28 17:06:18 +02:00
benoitc
b5aab16bf5 swicth confing load order
fix #800
2014-06-28 16:54:51 +02:00
Thomas Grainger
2bde8eb103 Support loading config from module 2014-06-20 09:20:37 +01:00
Randall Leeds
fd22ea24ae Merge pull request #727 from benoitc/feature/651
PR that rebase #651. Should also fix #625.

Add the capability to load gunicorn.base.Application without the
loading of the arguments of the command line.
2014-05-07 14:53:29 -07:00
Stéphane Wirtel
6211560c47 Start the documentation for the BaseApplication class 2014-04-30 10:59:44 +02:00
Hobson Lane
a8e8b30e47 Fix code.djangoproject.com/ticket/20185
This change favors `python2` over `python3` by reversing the try/except order. 

Untested in `python3`, as most Django packages are not yet `python3`-compatible.
Works in `python2`, `Django 1.5.4`, `gunicorn 18.0`.

When running `gunicorn` in python 2, if a django model doesn't validate, the `gunicorn` will fail to display informative error messages about your model and instead complain about `str`/`unicode`:

Django was falsely accused of [this bug](https://code.djangoproject.com/ticket/20185)
2014-04-22 16:33:41 -07:00
Randall Leeds
e5442332fe Support running specific paster apps from .ini
Close #400
2014-03-08 18:16:03 -08:00
Randall Leeds
41e7aba3a9 bad variable reference in paste startup 2014-03-08 17:53:51 -08:00
Łukasz Kucharski
2b7c30d69f fix two misspellings 2014-01-23 10:42:55 +01:00
Stephane Wirtel
e273052e3f Add the capability to load gunicorn.base.Application without the loading
of the arguments of the command line.
2014-01-01 20:35:04 +01:00
benoitc
59bd9a6a9a deprecate the paste command. 2013-12-11 09:54:03 +01:00
benoitc
f43d299503 bump django version to 1.5 2013-11-04 13:36:21 +01:00
wong2
bbd8b16b6f fix a typo 2013-10-09 16:43:49 +08:00
wong2
8a94f901bc remove unused import 2013-10-09 16:43:34 +08:00
benoitc
4a2eaf202c fix wsgiapp loading 2013-08-27 23:25:16 +02:00
benoitc
b6af364c79 add the --paste option and deprecate gunicorn_paster
Instead of having multiple command line just use the gunicorn one.
gunicorn_django is deprecated as well.
2013-08-27 23:16:35 +02:00
benoitc
f886d86b46 deprecate gunicorn_django 2013-08-27 21:17:33 +02:00
benoitc
bdec5975ef remove any notion of gunicorn in main WSGIApplication
if someone want to use a django application and load a specific module it is
better to use the --env option.
2013-08-27 20:38:49 +02:00
benoitc
82256a93a5 add --chdir option
chdir to specified directory before apps loading.

Ex:

	$ gunicorn --chdir ./examples test:app

fix #384
2013-08-27 16:52:49 +02:00
Randall Leeds
90fb09f618 Don't reload the paster app when run with pserve
Using gunicorn with paster command line causes the application to
load before gunicorn. In this case, there is no choice but to preload
the application. Document this fact.

Fixes #528.
2013-08-06 03:29:58 -07:00
Randall Leeds
cbc55843bd typo 2013-08-05 22:19:02 -07:00
Randall Leeds
ec2ee0b127 Support for python config file option in paster
It is now possible to specify a file with "config" as an application
configuration key in a paste deploy configuration file. This allows
paster applications to use the full range of gunicorn settings even
when using paste/pserve rather than gunicorn_paster.

Fixes #540.
2013-08-05 22:04:43 -07:00
benoitc
cd90653fe3 fix non django application loading
fix error introduced in 423e203db944ea5b250e2816cbeb9c4741cc736f.
2013-06-29 06:25:18 +02:00
Benoit Chesneau
a8ecbd5764 Merge pull request #551 from gauravkumar37/master
Fix to read the settings module specified while running via gunicorn command
2013-06-24 01:25:17 -07:00
Moriyoshi Koizumi
f5847a2a52 give the initial global_conf to loadcontext to initialize the context properly. 2013-06-24 09:26:59 +02:00
Jorge Niedbalski R
c218792fa4 prevent call get_default_config_file if args.config exists 2013-06-22 06:48:01 -07:00
Jorge Niedbalski
cf6e765323 [gunicorn] added ``gunicorn.conf.py`` as default in case of no -c is specified 2013-06-21 15:30:31 -03:00
Jorge Niedbalski
54b4ffb68e try to use cwd() + gunicorn.conf.py as default config if no file is specified . see #52 2013-06-17 16:44:02 -03:00
Gaurav Kumar
423e203db9 Fix to read the settings module specified by --settings or django_settings parameter 2013-06-17 22:15:46 +05:30
benoitc
cc7f595adc Enable stdio inheritance.
Enable inheritance for stdio file descriptors in daemon mode. It allows
you in daemon mode to redirect the output to a file if needed.

By default in daemon mode gunicorn will close all file handle except if
you pass the "-R" options. In this cases STDIO will be preserved.

fix #309
2013-04-23 16:23:46 +02:00
benoitc
c31e0f9ac7 Exit when the config file isn't found.
fix #469
2013-04-21 07:40:06 +02:00
benoitc
038ae7a86c add dd `python -m gunicorn.app.wsgiapp`` support
fix #493
2013-04-21 07:03:59 +02:00
Chris Streeter
e908ec3359 Consistently get CWD across apps and arbiter.
The Arbiter is smart about getting the CWD; first it checks the CWD
environment (which doesn't resolve symlinks), then it falls back to the
python os.getcwd() (which does resolve symlinks). However, the Arbiter
is the only place that does this, which will then do the right thing
when we reexec. However, when reloading the Arbiter, it won't pick up
changes if the symlink has changed.

By changing the *app.py entry points to also use the same method for
determining the CWD, we'll insert a symlink path into the first location
in sys.path. Then our reloaded app will correctly pull in any new
changes.
2013-04-03 11:15:53 +02:00
benoitc
78478de364 fix pythonpath option.
fix #501
2013-04-03 11:09:12 +02:00
Chris Streeter
25283ea262 Fix a Typo 2013-02-19 18:18:41 -08:00
benoitc
dae4d38705 add syslog support.
Add options to setup logging to syslog:

- `--log-syslog`: enable syslog. It default to `/var/run/syslog` on darwin,
  `/var/run/log` on freebsd, `/dev/log` on openbsd and udp://localhost:514 for
  other platforms.
- `--log-syslog-prefix: Pass the parameter to use as the program name
- `--log-syslog-to`: Setup the syslog address to send message. Address startinf
  by udp:// will send to udp, unix:// to a unix socket and tcp:// to tcp (useful
  for rsyslog)

fix #452 .
2012-12-25 06:19:06 +01:00
benoitc
ac1af72922 s/optparse/argparse 2012-12-25 06:19:06 +01:00
Adnane Belmadiaf
20cd49595a PEP8 fixes 2012-12-24 09:53:03 +01:00
benoitc
b7b51adf13 allows gunicorn to bind to multiple address
Allows gunicorn to listen on different interface. It can be either ipv6,
unix or ipv4 sockets.

Ex:

    gunicorn -w3 -b 127.0.0.1:8001 -b 127.0.0.1:8000 -b [::1]:8000 test:app

fix #444
2012-12-14 10:18:39 +01:00
benoitc
f724c53e17 make sure to add the current dir to sys.path as well. close #322 2012-11-19 08:33:05 +01:00