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 '
()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
Reference
The centos system is installed on the server.
Uwsgi is installed using Pip.
Nginx is installed using Yum install nginx.
Python 2.7 and MySQL 5.5 are installed using yum.
The logical relationship between them is as follows:
the web client
Uswgi is responsible for retrieving content from Django, transmitting it to Web server such as nginx through socket, and finally displaying it in a web browser.
In a
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
a password to log in and perform the relevant action. 0x03. Automating the deployment of Django using fabric
My needs are simple, and I need to redeploy the Django project on the Raspberry Pi every time I finish writing, and the settings.py and wsgi.py files are different from the development environment, so they can't be overwritten. So my basic deployment steps are: Fetch from git, jump to the project di
Introduction: You can still use Geronimo as a test and deployment environment for your portal applications, even though the functional focus of Apache Geronimo lacks the integrated Portal Server support. This article will guide you step-by-step through the process of deploying the Apache Pluto Drive and container in Geronimo, providing your portal application with a complete open source environment. Then le
Deploy Django Flask, wfastcgiiisdjango in IIS with wfastcgi
Django and Flask can be conveniently deployed in FastCGI mode under Linux. It seems that the configuration below IIS is not good, and IIS also lacks a fully automatic configuration tool like PHPmanager, the deployment on the company's servers is quite complex. After the deployment, the process is not co
Nginx + uwsgi or fastcgi deploy the Django project, nginxdjangoNginx + uwsgi
Install the C compiler and Python environment in ubuntu:
sudo apt-get install build-essential python-dev
Use pip to install uwsgi:
pip install uwsgi
Nginx Configuration:
You can set a configuration file for the site separately:
sudo vim /etc/nginx/sites-enabled/mysite
You can also directly set it in nginx. conf:
sudo vim /etc/nginx
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
Many shared hosting service providers do not allow you to run your own service processes or modify the httpd.conf file. Nonetheless, it is still possible to run Django through a child process generated by the Web server.
Recording
If you want to use the server sub-process, you do not need to start the fastcgi server yourself. Apache will automatically generate a number of sub-processes, and the resulting q
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
listening on 127.0.0.1:9000 # #location ~ \.php$ {# include snippets/fastcgi-php.conf; # # # with php7.0-cgi alone: # Fastcgi_pass 127.0.0.1:9000; # # with PHP7.0-FPM: # Fastcgi_pass Unix:/run/php/php7.0-fpm.sock; #} # Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' s one # #location ~/\.ht {# Deny All; #}}Change the your_ip to your IP, and the project address is changed7. Startsudo uwsgi uwsgi.inisudo s
Linux: deploy apache configurations for multiple projects on an apache server.
Step 1:
Get the code to the/var/www/html directory (this is the default directory, depending on apache settings). Multiple projects can be stored in this directory, for example:
[Root @ www html] # pwd/Var/www/html[Root @ www html] # lsBossm
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_
[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
Create a virtual directoryOpen apache->conf->httpd.confPaste at the bottomNamevirtualhost 127.0.0.1 DocumentRoot "website Absolute directory" If you build multiple, configure directly ServerName xxx DocumentRoot "XXX" After the configuration is complete, parse it in the host file.You can res
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
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
: Apache + Python + mod_python + Django compilation and Installation Guide
Apache + Python + mod_python + Django compilation and Installation Guide
1. This article will show you how to install the SDK using the source code package in Linux.
Apache 2.2.16
Python 1, 2.7
Mod_py
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.