首页 文章 精选 留言 我的

精选列表

搜索[部署],共10000篇文章
优秀的个人博客,低调大师

阿里云服务器 debian9 apache2 部署flask+wsgi 过程总结

由于阿里云镜像自带的源更新比较缓慢,最新的python3版本还是3.5,而我的代码使用的库需要python3.6+,因此需要先更新debian源: vim /etc/apt/sources.list 在其中添加: deb http://mirrors.163.com/debian/ testing main 执行: apt-get update apt-get install python3.6 python3.6-dev python3.6-distutils apt-get install python-pip 安装wsgi: sudo apt-get install libapache2-mod-wsgi-py3 在/etc/apache2/sites-available中新建flask.conf文件,在其中输入: WSGIPythonPath /var/www/html/flask <VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName flask.yunwei123.tech # ServerAdmin webmaster@localhost DocumentRoot /var/www/html/flask # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined WSGIScriptAlias / /var/www/html/flask/app.wsgi <Directory /var/www/html/flask> Require all granted <Files app.wsgi> Allow from all </Files> </Directory> # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 保存。 在网站根目录(这里是)新建app.wsgi文件,输入: from server import app as application 再在同一个目录下新建server.py, 输入: from flask import Flask import platform print(platform.python_version()) app = Flask(__name__) @app.route('/') def hello_world(): return platform.python_version() if __name__ == '__main__': app.run(host='0.0.0.0') 打开网页就可以看到啦。 这里搭建的网页: 使用 flask + pyechart 搭建的简单新冠肺炎疫情数据可视化交互分析平台,包含疫情数据获取、态势感知、预测分析、舆情监测等任务:http://flask.yunwei123.tech/进行查看 包含完整代码和实现的github地址:https://github.com/yunwei37/COVID-19-NLP-vis

优秀的个人博客,低调大师

SpringBoot应用和PostgreSQL数据库部署到Kubernetes上的一个例子

创建一个名为ads-app-service的服务: 上述Service的yaml文件里每个字段,在Kubernetes的API文档里有详细说明。 https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#servicespec-v1-core 如何找到这个url呢? Reference->API Reference->v1.12: 比如Service yaml文件里Spec区域需要出现的字段,每个字段在帮助文档里有详细说明: Spec部分的子区域ports可以定义多个port,通过符号"-"代表一个类似数组的结构: ports数组里每个元素包含的字段: name nodePort port protocol targetPort 用kubectl create -f

优秀的个人博客,低调大师

pm2守护进程管理node.js+express+ejs部署服务器报错解决

Linux服务器CentOs7 官网安装node.js 我是用命令行wget http://........ 解压tar xf 还有其他压缩文件格式用不同命令解压 进入解压目录查看版本cd 解压文件的 bin 目录底下包含了 node、npm 等命令,使用 ln 命令设置软连接,根据实际路径写 ln -s /usr/local/nodejs/bin/npm /usr/local/bin/ ln -s /usr/local/nodejs/bin/node /usr/local/bin/ 查看版本,现在可以全局使用node命令了node -v 上传项目 安装pm2npm install pm2 -g 报错If 'pm2' is not a typo you can use command-not-found to lookup the package that contains it, like this:cnf pm2 解决报错ln -s /usr/local/src/nodejs/bin/pm2 /usr/local/bin 运行并设置项目名,以后可以在直接使用项目名或者idpm2 start app.js --name 'myapp'

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

用户登录
用户注册