From c398bdbdcfae5b5eb77143098e31aeb8357c11f7 Mon Sep 17 00:00:00 2001
From: JohnYan <84345999@qq.com>
Date: Thu, 20 Jan 2022 09:34:41 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=83=A8=E7=BD=B2=E6=96=87?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 7 ++-
db.sqlite3 | Bin 585728 -> 585728 bytes
deploy/nginx.conf | 49 ++++++++++++++++++
deploy/smartchart.service | 11 ++++
deploy/uwsgi.ini | 14 +++++
deploy/uwsgi_params | 16 ++++++
manage.py | 2 +-
.../__init__.py | 0
{django_smartchart => smartcharts}/asgi.py | 4 +-
{django_smartchart => smartcharts}/embeded.py | 0
.../settings.py | 32 ++++++++----
{django_smartchart => smartcharts}/urls.py | 2 +-
{django_smartchart => smartcharts}/wsgi.py | 4 +-
13 files changed, 122 insertions(+), 19 deletions(-)
create mode 100644 deploy/nginx.conf
create mode 100644 deploy/smartchart.service
create mode 100644 deploy/uwsgi.ini
create mode 100644 deploy/uwsgi_params
rename {django_smartchart => smartcharts}/__init__.py (100%)
rename {django_smartchart => smartcharts}/asgi.py (70%)
rename {django_smartchart => smartcharts}/embeded.py (100%)
rename {django_smartchart => smartcharts}/settings.py (80%)
rename {django_smartchart => smartcharts}/urls.py (96%)
rename {django_smartchart => smartcharts}/wsgi.py (70%)
diff --git a/README.md b/README.md
index ee2a427..8472a33 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
-
+
@@ -83,7 +83,7 @@
### 应用场景一:
-如果你不熟悉django/python, 仅需要一个可视化开发平台, 可以快速启动, 独立平台使用
+如果你仅需要一个数据可视化,大屏开发平台, 可以快速启动, 独立平台使用
```shell script
本地命令行启动:
smartchart
@@ -200,4 +200,7 @@ v5.1
- 静态资源优化, 增加VIP模板功能
- 增加一键实现滚动表格及图片轮播图形, 增加一键实现边框效果
- 增强体验去除默认加载地图js, 所有非常用js改为动态加载
+v5.1.10 增加rem与px互转功能,优化模板开发体验
```
+
+
diff --git a/db.sqlite3 b/db.sqlite3
index b0ae1568178ac100009319ec696bf9137dd5aff1..b3e04db8a33d3970288133bc4cb3345cbff59e36 100644
GIT binary patch
delta 2050
zcmah}Ta4po6}Dr0GNChZmM%=SJFrVvR4c&2m-sdhOdU@g=i*FmlN(!to!E(U_2lA7
zQnk|sY5T&KrI$?s360p&2Od_7rrn^bf+>ZHr@qp5D|TMGDo;f`p)RU$W>;kd75(l1
z{MP^beCIpoKj%Dkcu`@3_6aLA07WDt-`!Ah=PIyvi{UG6M=9YC+|pRis+
z(@Ag{SXo(Fo)30KXmu-U>p$Ydr+@vyZ(qLi!i_tZuYd5`b07Zx7k8fd)e#F4CrJz^
zu=^GQYXt76D25>EAM9P-1K~y1y9;=q_wG&?_do;oUiMy^*?XYJySe~@E;n#%zW9Lm
z?k(@$+k9vC^Xs4qLag`Z)O`c2yZ`L{gZFjs&6#}zeAN380(o4(tt0u~k$m?^zB7CK
zcOc_v!B0-z2aeV{@&No7_{o`l04~Dc%3b`f2N2Me3g`hpn>EYwJaOdo^f10~YWKpB
z=5hAIkg4e0!;d}j#A9w3ak1opJa}gLe?h1VkdF@m&DDdvyGuldrJHeUjEbr?hSS=c$bM8%ICYIGO1+L`C9)k2
zGo&c174n(1JvOMcnba#)5tC^po$p9$K5{QV92cnLb;IHuFJhu_iBN;N>ieO4G-fET;T(4H@GfJ-*Z48F-Dj78FylEtg1KrM0HrbhI
zYHoK!OLe+Q*^cE$e+dOv)6uu!0nciMe!4$h5<$?x<_+j8(!4
zQu$7U-!&A1%UgO%kMQwe+}62V4x4OI$v~S*By@??!>O@WS4;9vOEhz_a5R>qRGnmu
zO53)$rd*LmG9D454Z$1>SvhOvHne`Cm8+(-kX-E5$3c2L$>VKYj#A+{g%7v3
zI)k3f7x~TIB45CTwovZpv$u|38URfEna2UJDkd!bk%ENi?Lv@?nLW;+}f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就启动2个
+worker_processes 2;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
+
+ access_log /data/smartchart/smartcharts/log/Nginx_access_main.log main;
+
+ sendfile on;
+ tcp_nodelay on;
+ keepalive_timeout 65;
+ types_hash_max_size 2048;
+
+ include mime.types;
+ default_type application/octet-stream;
+
+
+ server {
+ #这里是访问时用到的端口
+ listen 80;
+ server_name 0.0.0.0;
+
+
+ charset UTF-8;
+ #这块存日志文件
+ access_log /data/smartchart/smartcharts/log/Nginx_access.log;
+ error_log /data/smartchart/smartcharts/log/Nginx_error.log;
+
+ client_max_body_size 75M;
+ location /static/ {
+ alias /data/smartchart/smartcharts/static/;
+ }
+ location /media/ {
+ alias /data/smartchart/smartcharts/media/;
+ }
+ location / {
+ include uwsgi_params;
+ #同uwsgi内容
+ uwsgi_pass 127.0.0.1:8000;
+ }
+ }
+
+}
diff --git a/deploy/smartchart.service b/deploy/smartchart.service
new file mode 100644
index 0000000..6bb35cc
--- /dev/null
+++ b/deploy/smartchart.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Smartchart
+After=syslog.target
+[Install]
+WantedBy=multi-user.target
+[Service]
+WorkingDirectory=/data/smartchart/smartcharts
+ExecStart=uwsgi --ini /data/smartchart/smartcharts/deploy/uwsgi.ini
+User=smartchart
+Restart=always
+StandardError=syslog
\ No newline at end of file
diff --git a/deploy/uwsgi.ini b/deploy/uwsgi.ini
new file mode 100644
index 0000000..77c3274
--- /dev/null
+++ b/deploy/uwsgi.ini
@@ -0,0 +1,14 @@
+[uwsgi]
+#使用ngnix使用socket, 只使用uwsgi使用http
+#socket = 127.0.0.1:8000
+http = 0.0.0.0:8000
+chdir = /data/smartchart/smartcharts
+virtualenv = /data/smartchart/smartcharts/venv
+wsgi-file = /data/smartchart/smartcharts/smartcharts/wsgi.py
+processes = 4
+threads = 2
+master = True
+pidfile = /data/smartchart/smartcharts/uwsgi.pid
+daemonize = /data/smartchart/smartcharts/log/uwsgi.log
+disable-logging = true
+static-map=/static/=/data/smartchart/smartcharts/static
diff --git a/deploy/uwsgi_params b/deploy/uwsgi_params
new file mode 100644
index 0000000..d26f2ff
--- /dev/null
+++ b/deploy/uwsgi_params
@@ -0,0 +1,16 @@
+uwsgi_param QUERY_STRING $query_string;
+uwsgi_param REQUEST_METHOD $request_method;
+uwsgi_param CONTENT_TYPE $content_type;
+uwsgi_param CONTENT_LENGTH $content_length;
+
+uwsgi_param REQUEST_URI $request_uri;
+uwsgi_param PATH_INFO $document_uri;
+uwsgi_param DOCUMENT_ROOT $document_root;
+uwsgi_param SERVER_PROTOCOL $server_protocol;
+uwsgi_param REQUEST_SCHEME $scheme;
+uwsgi_param HTTPS $https if_not_empty;
+
+uwsgi_param REMOTE_ADDR $remote_addr;
+uwsgi_param REMOTE_PORT $remote_port;
+uwsgi_param SERVER_PORT $server_port;
+uwsgi_param SERVER_NAME $server_name;
\ No newline at end of file
diff --git a/manage.py b/manage.py
index 92429ad..dbd67c0 100755
--- a/manage.py
+++ b/manage.py
@@ -6,7 +6,7 @@ import sys
def main():
"""Run administrative tasks."""
- os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_smartchart.settings')
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'smartcharts.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
diff --git a/django_smartchart/__init__.py b/smartcharts/__init__.py
similarity index 100%
rename from django_smartchart/__init__.py
rename to smartcharts/__init__.py
diff --git a/django_smartchart/asgi.py b/smartcharts/asgi.py
similarity index 70%
rename from django_smartchart/asgi.py
rename to smartcharts/asgi.py
index 1d247fc..afbd00a 100644
--- a/django_smartchart/asgi.py
+++ b/smartcharts/asgi.py
@@ -1,5 +1,5 @@
"""
-ASGI config for django_smartchart project.
+ASGI config for smartcharts project.
It exposes the ASGI callable as a module-level variable named ``application``.
@@ -11,6 +11,6 @@ import os
from django.core.asgi import get_asgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_smartchart.settings')
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'smartcharts.settings')
application = get_asgi_application()
diff --git a/django_smartchart/embeded.py b/smartcharts/embeded.py
similarity index 100%
rename from django_smartchart/embeded.py
rename to smartcharts/embeded.py
diff --git a/django_smartchart/settings.py b/smartcharts/settings.py
similarity index 80%
rename from django_smartchart/settings.py
rename to smartcharts/settings.py
index 0967ca8..3ae3e11 100644
--- a/django_smartchart/settings.py
+++ b/smartcharts/settings.py
@@ -1,5 +1,5 @@
"""
-Django settings for django_smartchart project.
+Django settings for smartcharts project.
Generated by 'django-admin startproject' using Django 3.1.3.
@@ -21,7 +21,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
-SECRET_KEY = '#$lc1_v_)tof%192ew9fow#o+1#d1qu74d@c11y*sgjqkkl*&b'
+SECRET_KEY = '#$lc1_v_)tof%192ew9fow#o+1#d1qu84d@c11y*sgjqkkl*&b'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -55,7 +55,7 @@ MIDDLEWARE = [
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
-ROOT_URLCONF = 'django_smartchart.urls'
+ROOT_URLCONF = 'smartcharts.urls'
# 请参考此处的template设定
TEMPLATES = [
@@ -74,7 +74,7 @@ TEMPLATES = [
},
]
-WSGI_APPLICATION = 'django_smartchart.wsgi.application'
+WSGI_APPLICATION = 'smartcharts.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
@@ -83,9 +83,23 @@ DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
- }
+ },
}
+# 如果需要使用mysql数据库, 注释上面的sqlite, 启用下面的配置
+# import pymysql
+# pymysql.install_as_MySQLdb()
+# DATABASES = {
+# 'default': {
+# 'ENGINE': 'django.db.backends.mysql', # mysql数据库引擎
+# 'NAME': 'xx', # 数据库名
+# 'USER': 'xxx', # 用户名
+# 'PASSWORD': 'xxxxxx', # 密码
+# 'HOST': 'localhost', # mysql服务所在的主机ip
+# 'PORT': '3306', # mysql服务端口
+# },
+# }
+
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
@@ -108,20 +122,16 @@ AUTH_PASSWORD_VALIDATORS = [
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'zh-hans'
-
TIME_ZONE = 'Asia/Shanghai'
-
USE_I18N = True
-
USE_L10N = True
-
USE_TZ = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
-
+# 开启STATIC_ROOT后执行: python manage.py collectstatic
+# STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = '/static/'
-
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
diff --git a/django_smartchart/urls.py b/smartcharts/urls.py
similarity index 96%
rename from django_smartchart/urls.py
rename to smartcharts/urls.py
index 59b1b55..ebbe914 100644
--- a/django_smartchart/urls.py
+++ b/smartcharts/urls.py
@@ -1,4 +1,4 @@
-"""django_smartchart URL Configuration
+"""smartcharts URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
diff --git a/django_smartchart/wsgi.py b/smartcharts/wsgi.py
similarity index 70%
rename from django_smartchart/wsgi.py
rename to smartcharts/wsgi.py
index 0dc21a8..0817c99 100644
--- a/django_smartchart/wsgi.py
+++ b/smartcharts/wsgi.py
@@ -1,5 +1,5 @@
"""
-WSGI config for django_smartchart project.
+WSGI config for smartcharts project.
It exposes the WSGI callable as a module-level variable named ``application``.
@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_smartchart.settings')
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'smartcharts.settings')
application = get_wsgi_application()