1
0
Fork 0

changed mail_state, implemented live, changed mail sender

This commit is contained in:
alpcentaur 2023-02-27 17:09:29 +00:00
parent cf784a05f1
commit ebdc3be903
4 changed files with 179 additions and 43 deletions

View File

@ -1,5 +1,5 @@
nohup: ignoring input nohup: ignoring input
[2022-12-05 10:02:21 +0000] [12084] [DEBUG] Current configuration: [2022-12-14 11:22:16 +0000] [29484] [DEBUG] Current configuration:
config: None config: None
bind: ['0:8000'] bind: ['0:8000']
backlog: 2048 backlog: 2048
@ -56,21 +56,21 @@ nohup: ignoring input
default_proc_name: foerderbarometer.wsgi default_proc_name: foerderbarometer.wsgi
pythonpath: None pythonpath: None
paste: None paste: None
on_starting: <function OnStarting.on_starting at 0x7f7f819e4c10> on_starting: <function OnStarting.on_starting at 0x7f7a70485c10>
on_reload: <function OnReload.on_reload at 0x7f7f819e4d30> on_reload: <function OnReload.on_reload at 0x7f7a70485d30>
when_ready: <function WhenReady.when_ready at 0x7f7f819e4e50> when_ready: <function WhenReady.when_ready at 0x7f7a70485e50>
pre_fork: <function Prefork.pre_fork at 0x7f7f819e4f70> pre_fork: <function Prefork.pre_fork at 0x7f7a70485f70>
post_fork: <function Postfork.post_fork at 0x7f7f819f60d0> post_fork: <function Postfork.post_fork at 0x7f7a704970d0>
post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f7f819f61f0> post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f7a704971f0>
worker_int: <function WorkerInt.worker_int at 0x7f7f819f6310> worker_int: <function WorkerInt.worker_int at 0x7f7a70497310>
worker_abort: <function WorkerAbort.worker_abort at 0x7f7f819f6430> worker_abort: <function WorkerAbort.worker_abort at 0x7f7a70497430>
pre_exec: <function PreExec.pre_exec at 0x7f7f819f6550> pre_exec: <function PreExec.pre_exec at 0x7f7a70497550>
pre_request: <function PreRequest.pre_request at 0x7f7f819f6670> pre_request: <function PreRequest.pre_request at 0x7f7a70497670>
post_request: <function PostRequest.post_request at 0x7f7f819f6700> post_request: <function PostRequest.post_request at 0x7f7a70497700>
child_exit: <function ChildExit.child_exit at 0x7f7f819f6820> child_exit: <function ChildExit.child_exit at 0x7f7a70497820>
worker_exit: <function WorkerExit.worker_exit at 0x7f7f819f6940> worker_exit: <function WorkerExit.worker_exit at 0x7f7a70497940>
nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f7f819f6a60> nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f7a70497a60>
on_exit: <function OnExit.on_exit at 0x7f7f819f6b80> on_exit: <function OnExit.on_exit at 0x7f7a70497b80>
proxy_protocol: False proxy_protocol: False
proxy_allow_ips: ['127.0.0.1'] proxy_allow_ips: ['127.0.0.1']
keyfile: None keyfile: None
@ -83,13 +83,13 @@ nohup: ignoring input
ciphers: None ciphers: None
raw_paste_global_conf: [] raw_paste_global_conf: []
strip_header_spaces: False strip_header_spaces: False
[2022-12-05 10:02:21 +0000] [12084] [INFO] Starting gunicorn 20.0.4 [2022-12-14 11:22:16 +0000] [29484] [INFO] Starting gunicorn 20.0.4
[2022-12-05 10:02:21 +0000] [12084] [DEBUG] Arbiter booted [2022-12-14 11:22:16 +0000] [29484] [DEBUG] Arbiter booted
[2022-12-05 10:02:21 +0000] [12084] [INFO] Listening at: http://0.0.0.0:8000 (12084) [2022-12-14 11:22:16 +0000] [29484] [INFO] Listening at: http://0.0.0.0:8000 (29484)
[2022-12-05 10:02:21 +0000] [12084] [INFO] Using worker: sync [2022-12-14 11:22:16 +0000] [29484] [INFO] Using worker: sync
[2022-12-05 10:02:21 +0000] [12086] [INFO] Booting worker with pid: 12086 [2022-12-14 11:22:16 +0000] [29486] [INFO] Booting worker with pid: 29486
[2022-12-05 10:02:21 +0000] [12084] [DEBUG] 1 workers [2022-12-14 11:22:16 +0000] [29484] [DEBUG] 1 workers
[2022-12-05 10:02:21 +0000] [12086] [ERROR] Exception in worker process [2022-12-14 11:22:16 +0000] [29486] [ERROR] Exception in worker process
Traceback (most recent call last): Traceback (most recent call last):
File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process() worker.init_process()
@ -115,6 +115,6 @@ Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'foerderbarometer' ModuleNotFoundError: No module named 'foerderbarometer'
[2022-12-05 10:02:21 +0000] [12086] [INFO] Worker exiting (pid: 12086) [2022-12-14 11:22:16 +0000] [29486] [INFO] Worker exiting (pid: 29486)
[2022-12-05 10:02:21 +0000] [12084] [INFO] Shutting down: Master [2022-12-14 11:22:16 +0000] [29484] [INFO] Shutting down: Master
[2022-12-05 10:02:21 +0000] [12084] [INFO] Reason: Worker failed to boot. [2022-12-14 11:22:16 +0000] [29484] [INFO] Reason: Worker failed to boot.

View File

@ -0,0 +1,68 @@
# Generated by Django 3.1.2 on 2022-12-12 11:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0093_remove_project_persons'),
]
operations = [
migrations.AlterField(
model_name='businesscard',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='concreteextern',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='concretevolunteer',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='email',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='honorarycertificate',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='ifg',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='library',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='list',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='literature',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='project',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
migrations.AlterField(
model_name='travel',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='END', max_length=6),
),
]

View File

@ -0,0 +1,68 @@
# Generated by Django 3.1.2 on 2022-12-14 12:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0094_auto_20221212_1146'),
]
operations = [
migrations.AlterField(
model_name='businesscard',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='concreteextern',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='concretevolunteer',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='email',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='honorarycertificate',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='ifg',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='library',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='list',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='literature',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='project',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
migrations.AlterField(
model_name='travel',
name='mail_state',
field=models.CharField(choices=[('NONE', 'noch keine Mail versendet'), ('INF', 'die Benachrichtigung End-Mail wurde bereits versendet'), ('END', 'alle automatischen Mails, auch surveyMail, wurden bereits versendet')], default='NONE', max_length=6),
),
]

View File

@ -244,19 +244,19 @@ class ExternView(CookieWizardView):
try: try:
# - mail with entered data to the Volunteer # - mail with entered data to the Volunteer
txt_mail_template = get_template('input/ifg_volunteer_mail.txt') txt_mail_template1 = get_template('input/ifg_volunteer_mail.txt')
html_mail_template = get_template('input/ifg_volunteer_mail.html') html_mail_template1 = get_template('input/ifg_volunteer_mail.html')
subject, from_email, to = 'Formular ausgefüllt', IF_EMAIL, data['email'] subject1, from_email1, to1 = 'Formular ausgefüllt', IF_EMAIL, data['email']
text_content = txt_mail_template.render(context) text_content1 = txt_mail_template1.render(context)
html_content = html_mail_template.render(context) html_content1 = html_mail_template1.render(context)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg1 = EmailMultiAlternatives(subject1, text_content1, from_email1, [to1])
msg.attach_alternative(html_content, "text/html") msg1.attach_alternative(html_content1, "text/html")
#msg.send() msg1.send()
print('ifg volunteer mail would have been sent') #print('ifg volunteer mail would have been sent')
#send_mail( #send_mail(
# 'Formular ausgefüllt', # 'Formular ausgefüllt',
# mail_template.render(context), # txt_mail_template1.render(context),
# IF_EMAIL, # IF_EMAIL,
# [data['email']], # [data['email']],
# fail_silently=False) # fail_silently=False)
@ -268,13 +268,13 @@ class ExternView(CookieWizardView):
subject, from_email, to = 'Formular ausgefüllt', IF_EMAIL, IF_EMAIL subject, from_email, to = 'Formular ausgefüllt', IF_EMAIL, IF_EMAIL
text_content = txt_mail_template.render(context) text_content = txt_mail_template.render(context)
html_content = html_mail_template.render(context) html_content = html_mail_template.render(context)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg2 = EmailMultiAlternatives(subject, text_content, from_email, [to])
msg.attach_alternative(html_content, "text/html") msg2.attach_alternative(html_content, "text/html")
#msg.send() msg2.send()
print('if mail would have been sent') #print('if mail would have been sent')
#send_mail( #send_mail(
# 'Formular ausgefüllt', # 'Formular ausgefüllt',
# mail_template.render(context), # txt_mail_template.render(context),
# IF_EMAIL, # IF_EMAIL,
# [IF_EMAIL], # [IF_EMAIL],
# fail_silently=False) # fail_silently=False)
@ -285,7 +285,7 @@ class ExternView(CookieWizardView):
return HttpResponse('Invalid header found. Data not saved!') return HttpResponse('Invalid header found. Data not saved!')
except SMTPException: except SMTPException:
modell.delete() modell.delete()
return HttpResponse('Error in sending mails (propably wrong adress?). Data not saved!') return HttpResponse('Error in sending mails (probably wrong adress?). Data not saved!')
return done(self.request) return done(self.request)