egg

How to deploy django server into production environment without a full source code?

六眼飞鱼酱① 提交于 2019-12-02 11:50:24
问题 I am still a newbie to Python and Django. I am developing a application using Django which will eventually go to the production server. It's a customized web application for the client. After doing some research, I found out Apache with mod_wsgi is the best option for Django deployment. I just have to copy and paste the code into the production server and the application is accessible. But what if I don't want to give the whole source code and give only the executable application to the

How to deploy django server into production environment without a full source code?

五迷三道 提交于 2019-12-02 03:10:31
I am still a newbie to Python and Django. I am developing a application using Django which will eventually go to the production server. It's a customized web application for the client. After doing some research, I found out Apache with mod_wsgi is the best option for Django deployment. I just have to copy and paste the code into the production server and the application is accessible. But what if I don't want to give the whole source code and give only the executable application to the client (P.S client wants to deploy the application to their own server) . Is something like this possible in

How to update a file in python egg

有些话、适合烂在心里 提交于 2019-12-01 19:19:43
We are using trac. In our setup we have a problem that is solved in repository. So I got the fixed file commit_update.py from the repository and I need to place it into Trac-0.12-py2.6.egg. As egg is just a ziped filed I just unziped it, changed the file and ziped again. After restarting trac, I've got a an error message: ExtractionError: Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 20] Not a directory The Python egg cache directory is currently set to: /var/trac/plugin-cache Perhaps your account does not have

What are the advantages of packaging your python library/application as an .egg file?

青春壹個敷衍的年華 提交于 2019-12-01 02:07:19
I've read some about .egg files and I've noticed them in my lib directory but what are the advantages/disadvantages of using then as a developer? From the Python Enterprise Application Kit community : "Eggs are to Pythons as Jars are to Java..." Python eggs are a way of bundling additional information with a Python project, that allows the project's dependencies to be checked and satisfied at runtime, as well as allowing projects to provide plugins for other projects. There are several binary formats that embody eggs, but the most common is '.egg' zipfile format, because it's a convenient one

What are the advantages of packaging your python library/application as an .egg file?

我们两清 提交于 2019-11-30 21:31:02
问题 I've read some about .egg files and I've noticed them in my lib directory but what are the advantages/disadvantages of using then as a developer? 回答1: From the Python Enterprise Application Kit community: "Eggs are to Pythons as Jars are to Java..." Python eggs are a way of bundling additional information with a Python project, that allows the project's dependencies to be checked and satisfied at runtime, as well as allowing projects to provide plugins for other projects. There are several

Access a file from a python egg

倾然丶 夕夏残阳落幕 提交于 2019-11-30 18:01:18
问题 Hi I am working with python packaging. I have 3 non-code files namely ['synonyms.csv', 'acronyms.csv', 'words.txt'] . These files exist in a folder structure Wordproject/WordProject/Repository/DataBank/ I have a RepositoryReader class at the path Wordproject/WordProject/Repository/ I've written a code that pulls the current location of the RepositoryReader and then looks for a subdirectory called DataBank and looks for the 3 files there. The problem is when I create an egg out of the code,

Importing Python libraries and gracefully handling if they are not availalble

三世轮回 提交于 2019-11-30 15:28:25
问题 I would like to import bunch of libraries and catch the exception. If I have only 1 try catch block I get 1 exception (the first one). Is there a pattern to iterate over all of the libs and have a separate exception for each individual missing lib? #!/usr/bin/env python try: import sys except: print sys.exc_info() try: import numpy as np except: print sys.exc_info() try: import scipy as sp except: print sys.exc_info() try: import os as os except: print sys.exc_info() try: from operator import

Importing Python libraries and gracefully handling if they are not availalble

时光毁灭记忆、已成空白 提交于 2019-11-30 14:28:46
I would like to import bunch of libraries and catch the exception. If I have only 1 try catch block I get 1 exception (the first one). Is there a pattern to iterate over all of the libs and have a separate exception for each individual missing lib? #!/usr/bin/env python try: import sys except: print sys.exc_info() try: import numpy as np except: print sys.exc_info() try: import scipy as sp except: print sys.exc_info() try: import os as os except: print sys.exc_info() try: from operator import itemgetter except: print sys.exc_info() try: import socket except: print sys.exc_info() try: import

继承和组合

老子叫甜甜 提交于 2019-11-30 03:13:20
一、组合 组合:组合指的是,在一个类中以另外一个类的对象(也就是实例)作为数据属性,称为类的组合 也就是说:一个类的属性是另一个类的对象,就是组合 例子: 圆环是由两个圆组成的,圆环的面积就是外圆的面积减去内圆的面积。圆环的周长就是内圆的周长加上外圆的周长,这个时候,我们首先设计一个圆形类,计算一个圆的面积和圆的周长。然后在‘圆环类’组合圆形的实例作为自己的属性来用(这样的目的就是为了不用在写面积和周长的方法了,直接组合圆类的面积和方法去求解。减少了代码的重用) 1 from math import pi 2 class Circle: 3 def __init__(self,r): 4 self.r=r 5 def perimater(self): 6 return 2*pi*self.r 7 def area(self): 8 return pi*self.r*self.r 9 # print(Circle.perimater('r',2)) 10 # print(Circle.area('r',3)) 11 12 13 class Circle_ring: #定义一个圆环类 14 def __init__(self,outside_r,inside_r): 15 outside_bijiao = max(outside_r,inside_r) 16 intside

Python packages and egg-info directories

不想你离开。 提交于 2019-11-29 20:06:44
Can someone explain how egg-info directories are tied to their respective modules? For example, I have the following: /usr/local/lib/python2.5/site-packages/quodlibet/ /usr/local/lib/python2.5/site-packages/quodlibet-2.0.egg-info/ I'm assuming the egg-info directory is to make the corresponding module visible to setuptools (easy_install), right? If so, how does setuptools tie the egg-info directory to the module directory? Assuming that I'm on the right track, and for the sake of example... If I wanted to make an existing package of mine visible to setuptools, could I just symlink the module