mirror of
https://gitee.com/smartchart/smartchart
synced 2025-05-04 16:49:24 +08:00
完善部署文件
This commit is contained in:
parent
2f8758a54b
commit
c398bdbdcf
@ -16,7 +16,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/Release-V5.0-green.svg" alt="Downloads">
|
||||
<img src="https://img.shields.io/badge/Release-V5.1-green.svg" alt="Downloads">
|
||||
<a target="_blank" href="https://www.python.org/downloads/release/python-390/">
|
||||
<img src="https://img.shields.io/badge/Python-3.6+-green.svg" />
|
||||
</a>
|
||||
@ -83,7 +83,7 @@
|
||||
|
||||
|
||||
### 应用场景一:
|
||||
如果你不熟悉django/python, 仅需要一个可视化开发平台, 可以快速启动, 独立平台使用
|
||||
如果你仅需要一个数据可视化,大屏开发平台, 可以快速启动, 独立平台使用
|
||||
```shell script
|
||||
本地命令行启动:
|
||||
smartchart
|
||||
@ -200,4 +200,7 @@ v5.1
|
||||
- 静态资源优化, 增加VIP模板功能
|
||||
- 增加一键实现滚动表格及图片轮播图形, 增加一键实现边框效果
|
||||
- 增强体验去除默认加载地图js, 所有非常用js改为动态加载
|
||||
v5.1.10 增加rem与px互转功能,优化模板开发体验
|
||||
```
|
||||
|
||||
|
||||
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
49
deploy/nginx.conf
Normal file
49
deploy/nginx.conf
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
11
deploy/smartchart.service
Normal file
11
deploy/smartchart.service
Normal file
@ -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
|
14
deploy/uwsgi.ini
Normal file
14
deploy/uwsgi.ini
Normal file
@ -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
|
16
deploy/uwsgi_params
Normal file
16
deploy/uwsgi_params
Normal file
@ -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;
|
@ -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:
|
||||
|
@ -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()
|
@ -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'),
|
||||
]
|
@ -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/
|
@ -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()
|
Loading…
x
Reference in New Issue
Block a user