Browsing articles tagged with "python - Admins Goodies"
Jan 19, 2013
tom

CherryPy 3 with Apache 2 using ModWSGI: stack traces?

I am trying to show stack traces or at least some sort of errors rendered to the HTML response while using a WSGI script. A ModuleNotFound exception is raised when I tried to import a module the script can’t seem to find (which is fine for now), but all that is reported in the HTTP response is a rather vague Internal Server Error status 500 error which looks like Apache’s work. How can I get […]

Continue Reading »
Dec 31, 2012
tom

uwsgi nginx web.py interal server error: application not found

Within my nginx sites-available/default this is the relevant portion for my app: location /app/ { include uwsgi_params; uwsgi_pass unix:///tmp/uwsgi.socket; } My app.xml file within the uwsgi/sites-available/ folder: <uwsgi> <socket>/tmp/uwsgi.socket</socket> <plugins>python</plugins> <chdir>/web/NetWeaveCustom</chdir> <module>index</module> </uwsgi> Finally my /web/NetWeaveCustom/index.py module is as follows: import weburls = ( ‘/(.*)’,’index’ )app = web.application(urls, globals()).wsgifunc()class index: def GET(self,name): return name Here is my uwsgi error log: [pid: 15963|app: -1|req: -1/15] 192.168.1.98 () {42 vars in 686 bytes} [Sun Dec 30 18:51:37 […]

Continue Reading »
Dec 17, 2012
tom

NFS volume file permissions

I have a Redhat 6.0 system (SELinux enabled), with a NFS volume mounted at /myvolume. The command ls -la /myvolume says it has owner “nobody” and group “nobody”. On this system I have Apache running as “apache” user and “apache” group. Apache runs a python script through mod_wsgi. This script creates a temporary directory (using tempfile.mkdtemp), creates some files in it and then moves the whole directory inside /myvolume. After the script has done its […]

Continue Reading »
Oct 17, 2012
tom

How do I rotate old log files to long-term backup?

I have logrotate set up to archive logs for 30 days; how do I set up my cron job to rotate them automatically from /var/log/net to the long-term storage I have mounted on /mnt/backup? I do not need to mangle the name when I archive them. EDIT: Example of file naming… wireless.log-20120916.gz… there is no fixed log name to key from (which is the assumption in Nikolaidis Fotis’ first answer) Asked by Mike Pennington You […]

Continue Reading »
Sep 26, 2012
tom

Installing mod_wsgi with python 2.7 on ubuntu

I tried to install mod_wsgi on my ubuntu server using the package manager, but noticed it depends on python 2.6. I’m using python 2.7, and would rather avoid installing 2.6… Does mod_wsgi really depend on python 2.6, even if I intend to run only python 2.7 with it? If not, is there a way to install mod_wsgi having only python 2.7 installed? Asked by Filipe Correia I’ve confirmed that the mod_wsgi package (libapache-mod-wsgi) supports both […]

Continue Reading »
Sep 23, 2012
tom

Django LDAP – How to map description field to Django group

I’m trying to set up LDAP authentication with my Django app using Django-Auth The basic idea I want to do is any LDAP user with “IT – Help Desk” in the description would get mapped to a certain Django group, a user with “Admin” in the description would go to another Django group, and anyone else wouldn’t be allowed in. (There are legacy reasons I have to use the description field, so that’s not an […]

Continue Reading »
Sep 17, 2012
tom

Python SVN Bindings – ImportError: No module named svn

I have recently updated my server using apt-get upgrade and then suddenly trac started showing the following error message: Warning: Can’t synchronize with repository “(default)” (Unsupported version control system “svn”: No module named svn). Look in the Trac log for more information. I have tried to install python-subversion, but that was installed already, so I have reinstalled it, but that didn’t help. ~# python Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 […]

Continue Reading »
Sep 7, 2012
tom

IPv6 Address Switch

I have IPv6 addresses on a Linux based server. How can I switch the current address to a new one? Is there a way to do it using shell commands? How about using Python? Thanks. Asked by Austin Modo Easy: ip -6 address add 2001:dead:beef::2/64 dev eth0. The same goes for removal: ip -6 address delete 2001:dead:beef::1/64 dev eth0 To show your addresses: ip -6 address show Answered by Falk Stern Check more discussion of […]

Continue Reading »
Jul 27, 2012
tom

How do I install psycopg2 for multiple python interpreters on a CentOS box?

I have a CentOS 5.5 box, which comes preloaded with Python 2.4. I wanted 2.6, so used yumto get it from the EPEL repository. I also used yum to install the psycopg2 package, but it installed it for Python 2.4. I tried copying /usr/lib/python2.4/site-packages/psycopg2/ to /usr/lib/python2.6/site-packages/, and when I ran my script, it worked… but it gave me a warning that said /usr/lib/python2.6/site-packages/psycopg2/__init__.py:69: RuntimeWarning: Python C API version mismatch for module _psycopg: This Python has […]

Continue Reading »
Jun 11, 2012
tom

Running apache + mod_wsgi as different user

I have a django project, which I am moving from the dev-server to apache. I have managed to get it server with mod_wsgi, but it runs as apache. Mod_wsgi documentation says, that if apache is run as root, it is possible to run mod_wsgi process as a different user. Q1: Is it possible to run mod_wsgi as different user without running apache as root? Q2: If answer to the above is no, how do I […]

Continue Reading »
Pages:1234567...28»