for f in listdir('.'):
if not f.endswith('.py'):
replace = f
source = f.split('(')[0]
file = open(f, 'r')
text = file.read()
file.close()
file = open(f, 'w')
file.write(text.replace(source, replace))
file.close
ALTER ИМЯ_ТВОЕЙ_БД `database_utf8` CHARACTER SET 'utf8';
ALTER ИМЯ_ТВОЕЙ_БД `database_utf8` COLLATE 'utf8_general_ci';
SELECT CONCAT( 'ALTER TABLE `', t.`TABLE_SCHEMA` , '`.`', t.`TABLE_NAME` , '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' ) AS sqlcode
FROM `information_schema`.`TABLES` t
WHERE 1
AND t.`TABLE_SCHEMA` = 'ИМЯ_ТВОЕЙ_БД'
ORDER BY 1
LIMIT 0 , 90
from flask_mail import Mail
from flask.ext.mail import Message
mail = Mail(app)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, recipients=recipients)
msg.body = text_body
msg.html = html_body
mail.send(msg)
def send_post(email, post):
send_email('This is a new post',
'admin@example.com',
[email],
post,
'<p>' + post + '</p>')