1, mezzanine介绍
mezzanine就是一个基于Django框架的应用, 详细可以参考官方网站:http://mezzanine.jupo.org/
2, Mezzanine 安装指南:
# Install from PyPI $ pip install mezzanine # Create a project $ mezzanine-project myproject $ cd myproject # Create a database $ python manage.py createdb # Run the web server $ python manage.py runserver
新建的项目如果要修改主题可以参考:https://github.com/renyi/mezzanine-themes.git
3,修改 nginx的配置文件
到你的 nginx 安装目录下的 conf目录下 修改配置文件 nginx.conf.
**** 关于部署由于之前静态文件的设置问题
cd /usr/local/nginx/conf/ gedit nginx.conf
添加如下内容:
注意 修改你对应项目的路径 比如 alias /home/daniel/myblog/static;
server { listen 8080; server_name 123456; location / { root /home/daniel/myblog/; uwsgi_pass 127.0.0.1:8000; include uwsgi_params; } location /static { autoindex on; alias /home/daniel/myblog/static; access_log off; log_not_found off; } location /robots.txt { alias /home/daniel/myblog/static; access_log off; log_not_found off; } location /favicon.ico { alias /home/daniel/myblog/static/img; access_log off; log_not_found off; } }
至于部署方式可以采用,uWSGI,http://projects.unbit.it/downloads/。
tar zxvf uwsgi-latest.tar.gz cd uwsgi-1.2.6 make cp uwsgi /usr/sbin/uwsgi
安装完uWSGI。
在你的工程目录下新建文件 django_wsgi.py
添加如下内容:
#!/usr/bin/env python # coding: utf-8 import os,sys if not os.path.dirname(__file__) in sys.path[:1]: sys.path.insert(0, os.path.dirname(__file__)) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from django.core.handlers.wsgi import WSGIHandler application = WSGIHandler()
新建文件django.xml
添加如下内容,注意修改为自己的路径:
<uwsgi> <socket>127.0.0.1:8000</socket> <master>true</master> <chdir>/home/daniel/myblog</chdir> <pythonpath>..</pythonpath> <wsgi-file>django_wsgi.py</wsgi-file> <enable-threads>true</enable-threads> </uwsgi>
最后运行: wsgi -x wsgi.xml
这是 配置好了,在浏览器输入: http://localhost:8080/
是不是能够浏览你的站点了。
具体配置可参见我的工程里的相关配置
https://github.com/ustcdane/Mezzanine-uwsgi-nginx
文章转自: http://blog.csdn.net/daniel_ustc/article/details/8855303

Tomergelistsinpython,YouCanusethe操作员,estextMethod,ListComprehension,Oritertools

在Python3中,可以通过多种方法连接两个列表:1)使用 运算符,适用于小列表,但对大列表效率低;2)使用extend方法,适用于大列表,内存效率高,但会修改原列表;3)使用*运算符,适用于合并多个列表,不修改原列表;4)使用itertools.chain,适用于大数据集,内存效率高。

使用join()方法是Python中从列表连接字符串最有效的方法。1)使用join()方法高效且易读。2)循环使用 运算符对大列表效率低。3)列表推导式与join()结合适用于需要转换的场景。4)reduce()方法适用于其他类型归约,但对字符串连接效率低。完整句子结束。

pythonexecutionistheprocessoftransformingpypythoncodeintoExecutablestructions.1)InternterPreterReadSthecode,ConvertingTingitIntObyTecode,whepythonvirtualmachine(pvm)theglobalinterpreterpreterpreterpreterlock(gil)the thepythonvirtualmachine(pvm)

Python的关键特性包括:1.语法简洁易懂,适合初学者;2.动态类型系统,提高开发速度;3.丰富的标准库,支持多种任务;4.强大的社区和生态系统,提供广泛支持;5.解释性,适合脚本和快速原型开发;6.多范式支持,适用于各种编程风格。

Python是解释型语言,但也包含编译过程。1)Python代码先编译成字节码。2)字节码由Python虚拟机解释执行。3)这种混合机制使Python既灵活又高效,但执行速度不如完全编译型语言。

useeAforloopWheniteratingOveraseQuenceOrforAspecificnumberoftimes; useAwhiLeLoopWhenconTinuingUntilAcIntiment.ForloopSareIdeAlforkNownsences,而WhileLeleLeleLeleLoopSituationSituationSituationsItuationSuationSituationswithUndEtermentersitations。

pythonloopscanleadtoerrorslikeinfiniteloops,modifyingListsDuringteritation,逐个偏置,零indexingissues,andnestedloopineflinefficiencies


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

Dreamweaver Mac版
视觉化网页开发工具

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能