Рубрики
Uncategorized

Платформа: схема развертывания nginx, tornado, Django, PHP и MySQL на MAC

Автор оригинала: David Wong.

Адрес проекта: https://github.com/yuyangit/bmproject

Все развернутые схемы находятся в сценарии следующим образом:

1. Краткое введение

Bmplatform is a service based on Python tornado framework, python Django framework and a PHP deployed in nginx forwarding operating system.
The principle is to open four ports of tornado service, one port of Django service and one port of PHP service in the operating system.
The ports of the four tornado services are the services that use Python to open the four ports of tornado, and use supervisor to manage the four processes.
One Django service is that Django is deployed in Python's uwsgi environment, and nginx forwards uwsgi.
A PHP service is PHP deployed in fastcgi environment. Nginx sends and receives messages through fastcgi and PHP.
In addition, the database currently used by bmplatform is mysql-5.6.

2. Описание в каталоге

The following directories are not absolute paths, but relative to the project path bmplatform

0.0 root directory - bmplatform: Project path, including all the paths required for development of the entire project.

1.0 project main directory - bmplatform / bmplatform: project main directory, including all the main business codes, including core (core tool) library (third-party maintenance code) main (main business) profile (project public configuration and settings) SQL (database SQL script) test (debugging and testing)

1.1 Resource Directory - bmplatform / media: Currently, the resources uploaded from the client or the front end are deployed in this directory because they are deployed on a single machine

1.2 module test - bmplatform / moduletest: directory for self test of module code unrelated to service

1.3 static resource - bmplatform / static: static resource directory, such as CSS JS png

1.4 template - bmplatform / template: web template, JSON template and other resources

1.5 work area - bmplatform / workspace: work area, mainly storing log (log), profile (deployment configuration), shell (convenient operation script)

1.5.1 log - bmplatform / workspace / log: log, Django (store Django running log report) supervisor (store running log report of tornado service monitored by supervisor)

1.5.2 configuration - bmplatform / workspace / Profile: nginx (about nginx configuration, where nginx / log is the log report of nginx service) PHP (about PHP deployment configuration) supervisor (about Supervisor deployment configuration) uwsgi (about Django deployment uwsgi environment configuration)

1.5.3 script - bmplatform / workspace / shell: store the operation script of bmplatform, where bmplatforminitial.command is to automatically deploy the environment on the Mac operating system, bmplatformrestart.command is to restart the bmplatform service, bmplatformstart.command is to start the bmplatform service, bmplatformstop.command is to shut down the bmplatform service, packages is to store the required security Tools are other script tools needed in shell script running

3. Инициализировать среду

Double click bmplatform / workspace / shell / bmplatforminitial.command

4. Эксплуатационное обслуживание

Double click bmplatform / workspace / shell / bmplatformrestart.command

5. Цель развертывания

The purpose of using this deployment is to make use of the Django framework for the development of admin and the convenience of building data model in Django. We use Django to develop the website background, and because the number of users in the background is much less than the front-end services. Therefore, it is precisely because of this that the foreground mainly uses tornado for development. As many tools in the future may appear BS and CS architecture, tornado can be used for high concurrency and friendly interface development. In the foreground and the whole bmplatform, tornado is mainly used to operate. Due to the diversity of technology in the team and some special needs, we have joined the PHP environment.

6.Описание URL-адреса:

Some basic URL configurations are fixed in nginx

When the first directory in the root directory of the URL is admin, you will visit Django services, such as http://domain.com/admin/ and http://domain.com/admin/login,
When the first directory in the root directory of the URL is static, the files in bmplatform / static will be accessed
When the first directory in the root directory of the URL is media, the files in bmplatform / media will be accessed
When the URL ends with. PHP, the PHP service is accessed
In other cases, access to services provided by tornado by default

7. Как развиваться

Create a new script (such as bmindexreqhandlers. Py) in bmplatform / main / site directory and create a new class (bmindexreqhandler inherits tornado.web.requesthandler in tornado),
In bmplatform / profile / settings / Web / bmurls.py, urllist adds a new URL according to the format, and is associated with the bmindexreqhandler class previously established. Then you can access the interface you established according to the path.

Оригинал: “https://developpaper.com/bmplatform-a-scheme-to-deploy-nginx-tornado-django-php-and-mysql-on-mac/”