#thebasedirectory (Fullpath) chdir=/opt/ourcmdb/ #项目目录 #djangoswsgifilemodule =OurCMDB.wsgi #wsgi .py Create a django project when you have generated catalog /opt/ ourcmdb/ourcmdb/wsgi.py#process-relatedsettings#mastermaster =true#maximumnumberofworker processesprocesses=4##...with appropriatepermissions-maybeneeded#chmod-socket= 664#clearenvironment onexitvacuum=true View the files under the projectNew Nginx Virtual configuration fileCat/etc/nginx
have been optimizing the code of their own blog, yesterday, the CSS style sheet was separated, as a staticFile, but didn't learn how Django uses static files, after some googleFinally solved.There are two ways Django uses static files, one that is deployed on Django, and the otheris deployed on Apache, the previous method has a certain flaw, inefficient, and will
It took some time these days to deploy the Django-developed Web project to Apache, referencing some official documents and documents on the Internet, or spending more time on the configuration process.
Convenient to have the need of friends, can refer to, less detours!
1. Django Project Deployment Environment descriptionOperating system: Red Hat Enterprise Linux
System version:CentOS 7.3Apache 2.4Django 1.11Problem descriptionThe Django project involves the upload operation, the upload file name contains Chinese, if use Runserver start the service, no problem!If you deploy the Django project to the Apache server, if you upload a file that contains Chinese, the error is:ASCII ' codec can ' t encode characters in position
Just a note, a lot of online tutorials: 1. Modify Nginx configuration file Server{listen80default_server;listen[::]:80default_serveripv6only=on;root /home/ranvane/gwdj;indexindex.htmlindex.htm;#makesiteaccessiblefrom http://localhost/server_namelocalhost;access_log/home/ranvane/ gwdj/python.access.log;error_log/home/ranvane/gwdj/python.error.log; location/{proxy_passhttp://127.0.0.1:8000; proxy_set_headerHost $host; proxy_set_header X-Real-IP $remote _addr;proxy_set_headerx-forwarded-for$ Proxy_
Ubuntu deploy Django Web in two ways: ubuntudjango
1. Use django's built-in Server framework to publish the web
The system administrator often needs to remotely log on to the Linux server through SSH or telent, and often runs tasks that take a long time to complete, such as system backup and ftp transmission. Generally, we open a remote terminal window for each of these tasks because they have been execut
This article describes how to deploy a Django application using FastCGI. FastCGI is also the most widely used module for Python framework and server connection, if you need it, you can refer to it as an alternative to the mod_python module. you can consider using the mod_wsgi module. The development time of this module is closer than that of mod_python, it has been used in the
()1 vim/var/www/html/buglist/buglist/settings.py1 allowed_hosts = [www.example.com',] ----Add your own domain name1Staticfiles_finders = (2 'Django.contrib.staticfiles.finders.FileSystemFinder',3 'Django.contrib.staticfiles.finders.AppDirectoriesFinder',4#'Django.contrib.staticfiles.finders.DefaultStorageFinder',5 )6Staticfiles_dirs = ('/var/www/html/buglist/static/css',-----Here to change the previous relative path to an absolute path7 '/var/www/html
Tags: file sudo remote etc access right get address Ubuntu effective1. Install MySQL and plugins:sudo apt-get install mysql-server mysql-clientsudo apt-get Install Libmysqld-devsudo apt-get install Python-devIn this process he will prompt you to enter the root password and confirm the password.Install the python and MySQL connection pluginMysqlclient2. Configure MySQL remote access permission (user name password self-modification)GRANT all privileges on * * to ' user name ' @ '% ' identified by
PrefaceThis note aims to simplify the route to deploy DJANGO2.XBefore you start your Ubuntu server, you ' d better the Change your SSH ports to another one, and never use ' 22 '. Because hackers would try many times to access your server. You can switch your SSH port by following scripts:cd /etc/init.d/sshlssudo# a configuration file like this# in vim mode, type ‘i‘ to insert# annotate the default port setting as ‘# port 22‘# add a new line after ‘por
Currently, Apache and mod_python are the most robust combinations for deploying Django on production servers. Mod_python is an Apache plug-in embedded with python in Apache. It loads Python code into the memory when the server starts.
Django requires support for apaceh 2.x and mod_python 3.x.
For Apache configuration, see: http://www.djangoproject.com/r/apache/docs/
Dep
First, preparatory work
1. Create a space on your own server or virtual machine (this case uses Ubuntu's Aliyun server)
mkvirtualenv [space name]
* * View all space * *
Workon * * Enter a space * *
Workon space Name2, upload the code to the server
3, run the project to see will be normal?
Python manage.py runserver
4, turn off the debug mode (under the project's settings.py file)
DEBUG = False
5, modify allow access to all places
**settings.py file * *
allowed_hosts = [' * ']
6. Implement a
[Django] deploy with fastcgi
The django official team has begun to deploy the django application with fastcgi. As a user who has used it before, I should post a configuration to commemorate it.Under Project
#! /bin/shcase "$@" in start) python manage.py runfcgi
This document uses fabric to automatically deploy its own Webtools project, saving time on the Go . Fabric Installation
The fabric installation is straightforward apt-get install fabric, but installing on Windows will cause the following error: Missing Visual C + + 9.0. You only need to download the Microsoft Visual C + + Compiler for Python 2.7 installation. When installed, a Fab.exe file is generated in the scripts directory and added to the environ
I. Setting up a virtual directory in a Web applicationIi. in the virtual directory, a file, Web. config, reads as follows: XML version= "1.0"?> Configuration> system.webserver> handlers> Clear/> Addname= "Staticfile"Path="*"verb="*"Modules= "Staticfilemodule,defaultdocumentmodule,directorylistingmodule"ResourceType= "either"requireaccess= "Read" /> handlers> system.webserver>Configuration> Ways to set up a static virtual directory in an Azure web app
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.