summaryrefslogtreecommitdiff
path: root/templates/gunicorn.erb
blob: 10f81faa14a0170f72ba77f5dec23ae56448bb68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
CONFIG = {
<% if @mode == 'django' -%>
  'mode': 'django',
<% else -%>
  'mode': 'wsgi',
<% end -%>
<% if @virtualenv -%>
  'environment': {
<% if @environment -%>
    'ENVIRONMENT': '<%= @environment %>',
<% end -%>
    'PYTHONPATH': '<%= @virtualenv %>'
  },
<% end -%>
  'working_dir': '<%= @dir %>',
  'user': '<%= @owner %>',
  'group': '<%= @group %>',
<% if @virtualenv -%>
  'python': '<%= @virtualenv %>/bin/python',
<% else -%>
  'python': '/usr/bin/python',
<% end -%>
  'args': (
<% if !@virtualenv and !@bind -%>
    '--bind=unix:/tmp/gunicorn-<%= @name %>.socket',
<% elsif @virtualenv and !@bind -%>
    '--bind=unix:<%= @virtualenv %>/<%= @name %>.socket',
<% else -%>
    '--bind=<%= @bind %>',
<% end -%>
    '--workers=<%= @processorcount.to_i*2 %>',
    '--timeout=30',
<% if @mode != 'django' -%>
    'app:app',
<% end -%>
  ),
}