Automatically publish planned blog posts
This commit is contained in:
parent
e79cc9b4ff
commit
58035b085f
21
publish_blog_posts.py
Normal file
21
publish_blog_posts.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
import pymysql
|
||||||
|
|
||||||
|
db = pymysql.connect('localhost', 'kingofdog', '123456', 'kingofdog')
|
||||||
|
cur = db.cursor()
|
||||||
|
|
||||||
|
try:
|
||||||
|
unpublished_posts = cur.execute('update blog_posts set postState = 1 where postState = 3 and postPublishDate < now()')
|
||||||
|
db.commit()
|
||||||
|
shutil.rmtree('admin+blog')
|
||||||
|
shutil.rmtree('blog+index')
|
||||||
|
shutil.rmtree('blog+search')
|
||||||
|
shutil.rmtree('blog+tag')
|
||||||
|
shutil.rmtree('blog+category')
|
||||||
|
shutil.rmtree('blog+post')
|
||||||
|
except:
|
||||||
|
print('it didnt work')
|
||||||
|
db.rollback()
|
||||||
|
|
||||||
|
db.close()
|
Reference in New Issue
Block a user