diff --git a/README.md b/README.md index ee2a427..8472a33 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@

- Downloads + Downloads @@ -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 b0ae156..b3e04db 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/deploy/nginx.conf b/deploy/nginx.conf new file mode 100644 index 0000000..fb1ffa5 --- /dev/null +++ b/deploy/nginx.conf @@ -0,0 +1,49 @@ +# 启动进程,通常设置成和cpu的数量相等,我这里就启动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()