unsubscribe 500 error fix

remotes/origin/stage5
Alexander Burdeiny 9 years ago
parent 1b617ab45f
commit 7171482a5e
  1. 2
      emencia/django/newsletter/forms.py
  2. 2
      emencia/django/newsletter/views/mailing_list.py
  3. 24
      fabfile.py
  4. 2
      support/dev/settings.py
  5. 12
      support/dev/tech_work_hit.expomap.ru
  6. 3
      support/prod/settings.py
  7. 97
      support/prod/tech_work_hit.expomap.ru

@ -293,7 +293,7 @@ class SubscribeSettingsForm(AbstractSubscribeForm):
europe_expo = forms.BooleanField(required=False, label=_(u'Выставки Европы')) europe_expo = forms.BooleanField(required=False, label=_(u'Выставки Европы'))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.contact = kwargs.pop('contact') self.contact = kwargs.pop('contact', None)
self.activation_send = False self.activation_send = False
lang = translation.get_language() lang = translation.get_language()
self.cities_choices = dict(City.objects.language(lang).all().values_list('pk', 'name')) self.cities_choices = dict(City.objects.language(lang).all().values_list('pk', 'name'))

@ -80,7 +80,7 @@ class UnsubscribeView(DetailView):
if setting.area.filter(id=SubscribeSettingsForm.EUROPE_ID).exists(): if setting.area.filter(id=SubscribeSettingsForm.EUROPE_ID).exists():
initial['europe_expo'] = True initial['europe_expo'] = True
form = SubscribeSettingsForm(instance=setting, initial=initial) form = SubscribeSettingsForm(instance=setting, initial=initial, contact=contact)
return form return form
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):

24
fabfile.py vendored

@ -86,11 +86,11 @@ def get_configs():
def put_configs(): def put_configs():
localdir = join(LOCAL_HOME_DIR, 'support/', env.role) localdir = join(LOCAL_HOME_DIR, 'support/', env.role)
# nginx # nginx
put(join(localdir, basename(nginx_conf)), # put(join(localdir, basename(nginx_conf)),
nginx_conf) # nginx_conf)
# apache2 # # apache2
put(join(localdir, basename(apache2_conf)), # put(join(localdir, basename(apache2_conf)),
apache2_conf) # apache2_conf)
# settings # settings
put(join(localdir, basename(settings_conf)), put(join(localdir, basename(settings_conf)),
settings_conf) settings_conf)
@ -126,11 +126,11 @@ def stage_init(stage_num):
run('git fetch') run('git fetch')
run('git checkout stage{stage_num}'.format(stage_num=stage_num)) run('git checkout stage{stage_num}'.format(stage_num=stage_num))
run('git pull') run('git pull')
stage_num = int(stage_num) # stage_num = int(stage_num)
if stage_num in stages and isinstance(stages[stage_num], dict): # if stage_num in stages and isinstance(stages[stage_num], dict):
for func_name, func in stages[stage_num].iteritems(): # for func_name, func in stages[stage_num].iteritems():
func() # func()
call_state('start', only='apache2') # call_state('start', only='apache2')
def migrate(app_name): def migrate(app_name):
@ -138,10 +138,10 @@ def migrate(app_name):
run('python manage.py migrate {app_name}'.format(app_name=app_name)) run('python manage.py migrate {app_name}'.format(app_name=app_name))
def devmode(state): def devmode(state=True):
localdir = join(LOCAL_HOME_DIR, 'support/', env.role) localdir = join(LOCAL_HOME_DIR, 'support/', env.role)
# nginx # nginx
conf = nginx_conf_tech if state else nginx_conf conf = nginx_conf_tech if state == True else nginx_conf
put(join(localdir, basename(conf)), nginx_conf) put(join(localdir, basename(conf)), nginx_conf)
run('/etc/init.d/nginx reload') run('/etc/init.d/nginx reload')

@ -394,6 +394,8 @@ CRONJOBS = [
# ('41 5 * * *', 'django.core.management.call_command', ['newsletter_create_announce']), # ('41 5 * * *', 'django.core.management.call_command', ['newsletter_create_announce']),
('12 4 * * *', 'django.core.management.call_command', ['stats_daily']), ('12 4 * * *', 'django.core.management.call_command', ['stats_daily']),
('5 10 * * *', 'django.core.management.call_command', ['update_events_filter_fields']),
] ]
PYMORPHY_DICTS = { PYMORPHY_DICTS = {

@ -4,6 +4,12 @@ server {
return 301 https://$host$request_uri; return 301 https://$host$request_uri;
} }
geo $maintenance {
default yes;
127.0.0.1/32 no;
31.43.24.170/24 no;
}
server { server {
listen 443; listen 443;
server_name 176.121.11.165 www.expomap.ru expomap.ru dev.expomap.ru; server_name 176.121.11.165 www.expomap.ru expomap.ru dev.expomap.ru;
@ -25,7 +31,9 @@ server {
error_page 503 /dev_work.html; error_page 503 /dev_work.html;
location / { location / {
return 503; if ($maintenance = yes) {
return 503;
}
auth_basic "Unauthorized"; auth_basic "Unauthorized";
auth_basic_user_file /home/www/proj/.htpasswd; auth_basic_user_file /home/www/proj/.htpasswd;
proxy_pass http://127.0.0.1:8080/; proxy_pass http://127.0.0.1:8080/;
@ -73,7 +81,7 @@ server {
} }
location = /dev_work.html { location = /dev_work.html {
root home/www/proj/support/; root /home/www/proj/support/;
internal; internal;
} }

@ -8,7 +8,7 @@ from django.utils.translation import ugettext_lazy as _
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__)) DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0] SITE_ROOT = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
DEBUG = False DEBUG = True
ADMINS = ( ADMINS = (
@ -394,6 +394,7 @@ CRONJOBS = [
('41 5 * * *', 'django.core.management.call_command', ['newsletter_create_announce']), ('41 5 * * *', 'django.core.management.call_command', ['newsletter_create_announce']),
('12 4 * * *', 'django.core.management.call_command', ['stats_daily']), ('12 4 * * *', 'django.core.management.call_command', ['stats_daily']),
('5 10 * * *', 'django.core.management.call_command', ['update_events_filter_fields']),
] ]
PYMORPHY_DICTS = { PYMORPHY_DICTS = {

@ -0,0 +1,97 @@
server {
server_name expomap.ru www.expomap.ru;
# listen 80;
return 301 https://expomap.ru$request_uri;
}
geo $maintenance {
default yes;
127.0.0.1/32 no;
31.43.24.170/24 no;
}
server {
listen 176.121.11.162:443 ssl;
server_name www.expomap.ru;
# ssl on;
# ssl_certificate /etc/nginx/ssl/expomap.ru.crt;
# ssl_certificate_key /etc/nginx/ssl/expomap.ru.key;
return 301 https://expomap.ru$request_uri;
}
server {
listen 176.121.11.162:443 ssl default_server ;
server_name expomap.ru ;
# ssl_stapling on;
ssl on;
ssl_certificate /etc/nginx/ssl/expomap.ru.crt;
ssl_certificate_key /etc/nginx/ssl/expomap.ru.key;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_session_timeout 24h;
ssl_session_cache shared:SSL:25m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers kEECDH+AES128:kEECDH:kEDH:-3DES:kRSA+AES128:kEDH+3DES:DES-CBC3-SHA:!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK:!SRP:!SSLv2;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000;";
add_header Content-Security-Policy-Report-Only "default-src https:; script-src https: 'unsafe-eval' 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data:; font-src https: data:";
client_header_timeout 360s;
error_page 503 /dev_work.html;
location / {
# auth_basic "Unauthorized";
# auth_basic_user_file /home/www/proj/.htpasswd;
if ($maintenance = yes) {
return 503;
}
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
include /etc/nginx/geoip_proxy.conf;
client_max_body_size 100m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 256 8k;
proxy_busy_buffers_size 2000k;
proxy_temp_file_write_size 2048k;
}
location /965E1EE7949FD639CA0124C8D8C57774.txt {
root /home/www/proj/;
}
location /4885b11a73674eb6d54593c1d7efd758821e5ee79b8132feecaba10560f0123a.html {
root /home/www/proj/support;
}
location /static {
root /home/www/proj;
}
location /media {
root /home/www/proj;
}
location /templates {
root /home/www/proj/static;
}
location /subdmn {
root /home/old_files;
}
}
Loading…
Cancel
Save