How to configure Python with virtualenv locally and on a real Linode server (or similar)?

Using PyCharm on Windows and I would like to get a better idea of ​​how to configure the local environment so that it transforms as much as possible to my servers on Linode (or any other Linux server).

I have a physical disk dedicated for development work. In my case, this is a disk Z:.

Usually I create one directory for each project. A project is defined as an entire website.

Currently, I have also selected the directory Z:\virtualenvwhere I create my virtual environments. One for the project. I believe that several projects can use the same virtualenv, but I'm not sure if this is reasonable for development or production.

I considered the idea that a virtual project for each project lives inside the corresponding project. This attracts me, because then every project will be monolithic. For example, if we are talking about the Flask application in PyCharm:

d    z:\flask_app
d         .git
d         .idea
d         static
d         templates
d         virtualenv
          main.py

How, for example, do you install the production server mentioned above?

Suppose that one uses one machine to host multiple sites through virtual hosting, and this is one of them:

<VirtualHost *:80>
  ServerAdmin you@example.com

  ServerName   example.com
  ServerAlias  example.com *.example.com
  DocumentRoot /var/www/example/public_html
  ErrorLog     /var/www/example/logs/access.log
  CustomLog    /var/www/example/logs/error.log combined

  <Directory   /var/www/example>
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
  </Directory>
</VirtualHost>

Am I installing virtualenv on a global server level? I think the global yes. He could not work otherwise. I do not think.

OK, that means the whole file structure in

z:\flask_app

can now be ftp'd in

/var/www/example/public_html

and is the site good to go?

, db, db, .. . Python Python virtualenv Linux.

, virtualenv , , ? . , , , , .

Ubuntu 14.04 LTS, .

14.04 Desktop , Windows.

+4
2

1) 14.04 , , , - .

2) , virtualenvwrapper. , ( ). virtualenvs (/). : mkproject ( virtualenv ) workon ( ).

3) , , 14.04 , virtualenv, , python-virtualenv (1.11.4). , python, .

, , ... FTP'd ... ?

, virtualenv, Python Windows, , Python Linux/Ubuntu.

4) , , requirements.txt. virtualenv pip install -r requirements.txt, .

5) WSGI, Chaussette (, Circus) uWSGI, WSGI python port/unix; Apache Nginx - (. SO ).

6) - bash , , :) , , Salt.

+3

: Git , , . virtualenv, (Python, pip), , . .

virtualenv , .gitignore, , . FTP- : virtualenv ( , ).

, Windows Linux, . " " " , ".

, , ( , -, ) virtualenv, . -, .

, , , , . , , git, virtualenv, , . Ansible, .

, , . ? , - . ? , - . .

+1

Source: https://habr.com/ru/post/1545607/


All Articles