Merge branch 'master' of http://git.eanbo.cn/xieshen/newmediamonitoring
This commit is contained in:
commit
660db81f08
|
@ -153,9 +153,9 @@ STATIC_URL = '/static/'
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
os.path.join(BASE_DIR, "static"),
|
os.path.join(BASE_DIR, "static"),
|
||||||
]
|
]
|
||||||
STATIC_ROOT = '/var/www/p3/newmediamonitoring/static/'
|
STATIC_ROOT = '/var/www/p3.8/newmediamonitoring/static/'
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
MEDIA_ROOT = '/var/www/p3/newmediamonitoring/media/'
|
MEDIA_ROOT = '/var/www/p3.8/newmediamonitoring/media/'
|
||||||
"""用户模块扩展部分"""
|
"""用户模块扩展部分"""
|
||||||
AUTH_PROFILE_MODULE = 'djangoadmin.myadmin.UserProfile'
|
AUTH_PROFILE_MODULE = 'djangoadmin.myadmin.UserProfile'
|
||||||
"""用户模块扩展完成"""
|
"""用户模块扩展完成"""
|
||||||
|
|
|
@ -16,5 +16,6 @@ import traceback
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NewMediaMonitoring.settings')
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'NewMediaMonitoring.settings')
|
||||||
sys.path.append("/var/www/p3/newmediamonitoring/current")
|
# sys.path.append("/var/www/p3/newmediamonitoring/current")
|
||||||
|
sys.path.append("/var/www/p3.8/newmediamonitoring/current")
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
from fabistrano import deploy
|
from fabistrano import deploy
|
||||||
from fabric.api import env
|
from fabric.api import env
|
||||||
|
|
||||||
env.hosts = ["nut@210.72.82.249"] # Replace with your host name or IP
|
# env.hosts = ["nut@210.72.82.249"] # Replace with your host name or IP
|
||||||
env.base_dir = '/var/www/p3' # Set to your app's directory
|
env.hosts = ["root@182.92.56.18"] # Replace with your host name or IP
|
||||||
|
# env.base_dir = '/var/www/p3' # Set to your app's directory
|
||||||
|
env.base_dir = '/var/www/p3.8' # Set to your app's directory
|
||||||
env.app_name = 'newmediamonitoring' # This will deploy the app to /www/app_name.com/
|
env.app_name = 'newmediamonitoring' # This will deploy the app to /www/app_name.com/
|
||||||
env.git_clone = 'http://210.77.77.77/xieshen/newmediamonitoring.git' # Your git url
|
env.git_clone = 'http://210.77.77.77/xieshen/newmediamonitoring.git' # Your git url
|
||||||
env.remote_owner = 'nut'
|
# env.remote_owner = 'nut'
|
||||||
env.remote_group = 'www-data'
|
env.remote_owner = 'root'
|
||||||
env.restart_cmd = 'sudo service apache2 restart'
|
# env.remote_group = 'www-data'
|
||||||
|
env.remote_group = 'root'
|
||||||
|
# env.restart_cmd = 'sudo service apache2 restart'
|
||||||
|
env.restart_cmd = 'systemctl restart httpd.service'
|
||||||
|
|
|
@ -131,8 +131,13 @@ def timeliness_monitoring_weixin(request):
|
||||||
this_week_end = now + timedelta(days=6 - now.weekday())
|
this_week_end = now + timedelta(days=6 - now.weekday())
|
||||||
# 本月第一天和最后一天
|
# 本月第一天和最后一天
|
||||||
this_month_start = datetime.datetime(now.year, now.month, 1)
|
this_month_start = datetime.datetime(now.year, now.month, 1)
|
||||||
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
|
if now.month == 12:
|
||||||
hours=23, minutes=59, seconds=59)
|
this_month_end = datetime.datetime(now.year, now.month , 1) - timedelta(days=1) + datetime.timedelta(
|
||||||
|
hours=23, minutes=59, seconds=59)
|
||||||
|
else:
|
||||||
|
this_month_end = datetime.datetime(now.year, now.month, 1) - timedelta(days=1) + datetime.timedelta(
|
||||||
|
hours=23, minutes=59, seconds=59)
|
||||||
|
|
||||||
# 新媒体数量
|
# 新媒体数量
|
||||||
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
|
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
|
||||||
Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count())
|
Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count())
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#Django~=2.2.15
|
Django~=2.2.15
|
||||||
#django-bootstrap3
|
django-bootstrap3
|
||||||
#django-simple-captcha
|
django-simple-captcha
|
||||||
#psycopg2-binary
|
psycopg2-binary
|
||||||
#django-cors-headers
|
django-cors-headers
|
||||||
#aliyun-python-sdk-core-v3
|
aliyun-python-sdk-core-v3
|
||||||
#channels
|
channels
|
||||||
#requests
|
requests
|
||||||
#parsel
|
parsel
|
||||||
#django-summernote
|
django-summernote
|
||||||
#python-dateutil
|
python-dateutil
|
||||||
#channels_redis[cryptography]
|
channels_redis[cryptography]
|
||||||
#jieba
|
jieba
|
||||||
#aliyun-python-sdk-core
|
aliyun-python-sdk-core
|
||||||
#aliyun-python-sdk-dyvmsapi
|
aliyun-python-sdk-dyvmsapi
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
#更新新媒体脚本,结果为有出入的新媒体列表。
|
||||||
|
'''
|
||||||
|
1,将excel转为csv,使用utf-8编码集。
|
||||||
|
2、获取csv内容
|
||||||
|
3、与数据库中的数据逐项对比
|
||||||
|
'''
|
||||||
|
import csv
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import psycopg2 as psycopg2
|
||||||
|
|
||||||
|
# code = None
|
||||||
|
# alias = None
|
||||||
|
# attention = None
|
||||||
|
# remark = None
|
||||||
|
# identificationcode = None
|
||||||
|
# function = None
|
||||||
|
# articleurl = None
|
||||||
|
# weixinid = None
|
||||||
|
# type = None
|
||||||
|
G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
|
||||||
|
|
||||||
|
def get_csv_weixin(path):
|
||||||
|
with open("D:/2020/新媒体监测/新媒体对比结果_其他.csv", "w", newline='') as csvfile:
|
||||||
|
writer = csv.writer(csvfile)
|
||||||
|
writer.writerow(
|
||||||
|
["序号", "冲突账号"])
|
||||||
|
|
||||||
|
with psycopg2.connect(G2) as connection:
|
||||||
|
with open(path, encoding='utf-8') as csvfile:
|
||||||
|
reader = csv.reader(csvfile)
|
||||||
|
for r in reader:
|
||||||
|
if r[1] != '单位全称':
|
||||||
|
if '头条' not in r[7] and '微信' not in r[7] and '微博' not in r[7] and '抖音' not in r[7]:
|
||||||
|
name = r[1]
|
||||||
|
code = r[4]
|
||||||
|
identificationcode = r[3]
|
||||||
|
function = r[8]
|
||||||
|
articleurl = r[12]
|
||||||
|
biz = r[13]
|
||||||
|
province = None
|
||||||
|
cities = None
|
||||||
|
district = None
|
||||||
|
d_name = None
|
||||||
|
c_name = None
|
||||||
|
p_name = None
|
||||||
|
|
||||||
|
print(r)
|
||||||
|
try:
|
||||||
|
with connection.cursor() as cursor_p:
|
||||||
|
cursor_p.execute(
|
||||||
|
"select * from dashboard_area_code_2020 where name = '%s'" % (r[9]))
|
||||||
|
for p in cursor_p:
|
||||||
|
province = p[1]
|
||||||
|
p_name = p[2]
|
||||||
|
with connection.cursor() as cursor_c:
|
||||||
|
cursor_c.execute(
|
||||||
|
"select * from dashboard_area_code_2020 where name = '%s'" % (r[10]))
|
||||||
|
for c in cursor_c:
|
||||||
|
cities = c[1]
|
||||||
|
c_name = c[2]
|
||||||
|
with connection.cursor() as cursor_d:
|
||||||
|
cursor_d.execute(
|
||||||
|
"select * from dashboard_area_code_2020 where name = '%s'" % (r[11]))
|
||||||
|
for d in cursor_d:
|
||||||
|
district = d[1]
|
||||||
|
d_name = d[2]
|
||||||
|
print(code)
|
||||||
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute(
|
||||||
|
"select * from dashboard_qita where code = '%s'" % (code))
|
||||||
|
# connection.commit()
|
||||||
|
|
||||||
|
for c in cursor:
|
||||||
|
print(str(c[10]) + "1111111111111111111111")
|
||||||
|
with connection.cursor() as cursor2:
|
||||||
|
cursor2.execute(
|
||||||
|
"select * from dashboard_organization where id = '%s'" % (c[10]))
|
||||||
|
for c2 in cursor2:
|
||||||
|
print(str(c2[0]) + "55555555555555555555555")
|
||||||
|
|
||||||
|
if str(name) == str(c2[1]) and str(province) == str(c2[3]) and str(
|
||||||
|
cities) == str(c2[4]) and str(district) == str(c2[5]) and str(
|
||||||
|
code) == str(c[1]) and str(identificationcode) == str(
|
||||||
|
c[13]) and str(biz) == str(c[9]):
|
||||||
|
print(c2)
|
||||||
|
else:
|
||||||
|
writer.writerow(
|
||||||
|
[r[0], name, code, identificationcode, biz, p_name, c_name,
|
||||||
|
d_name])
|
||||||
|
writer.writerow(
|
||||||
|
[r[0], c2[1], c[1], c[13], c[9], c2[3], c2[4], c2[5]])
|
||||||
|
|
||||||
|
except:
|
||||||
|
writer.writerow(
|
||||||
|
[r[0], name, code, identificationcode, biz, p_name, c_name,
|
||||||
|
d_name])
|
||||||
|
if __name__ == '__main__':
|
||||||
|
get_csv_weixin('D:/2020/新媒体监测/TASK_ALL.csv')
|
Loading…
Reference in New Issue