Search Results

Search found 2429 results on 98 pages for 'mod wsgi'.

Page 20/98 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Error 2006: "MySQL server has gone away" using Python, Bottle Microframework and Apache

    - by Jamie
    After accessing my web app using: - Python 2.7 - the Bottle micro framework v. 0.10.6 - Apache 2.2.22 - mod_wsgi - on Ubuntu Server 12.04 64bit; I'm receiving this error after several hours: OperationalError: (2006, 'MySQL server has gone away') I'm using MySQL - the native one included in Python. It usually happens when I don't access the server. I've tried closing all the connections, which I do, using this: cursor.close() db.close() where db is the standard MySQLdb.Connection() call. The my.cnf file looks something like this: key_buffer = 16M max_allowed_packet = 128M thread_stack = 192K thread_cache_size = 8 # This replaces the startup script and checks MyISAM tables if needed # the first time they are touched myisam-recover = BACKUP #max_connections = 100 #table_cache = 64 #thread_concurrency = 10 It is the default configuration file except max_allowed_packet is 128M instead of 16M. The queries to the database are quite simple, at most they retrieve approximately 100 records. Can anyone help me fix this? One idea I did have was use try/except but I'm not sure if that would actually work. Thanks in advance, Jamie

    Read the article

  • System architecture: simple approach for setting up background tasks behind a web application -- wil

    - by Tim Molendijk
    I have a Django web application and I have some tasks that should operate (or actually: be initiated) on the background. The application is deployed as follows: apache2-mpm-worker; mod_wsgi in daemon mode (1 process, 15 threads). The background tasks have the following characteristics: they need to operate in a regular interval (every 5 minutes or so); they require the application context (i.e. the application packages need to be available in memory); they do not need any input other than database access, in order to perform some not-so-heavy tasks such as sending out e-mail and updating the state of the database. Now I was thinking that the most simple approach to this problem would be simply to piggyback on the existing application process (as spawned by mod_wsgi). By implementing the task as part of the application and providing an HTTP interface for it, I would prevent the overhead of another process that is holding all of the application into memory. A simple cronjob can be setup that sends a request to this HTTP interface every 5 minutes and that would be it. Since the application process provides 15 threads and the tasks are quite lightweight and only running every 5 minutes, I figure they would not be hindering the performance of the web application's user-facing operations. Yet... I have done some online research and I have seen nobody advocating this approach. Many articles suggest a significantly more complex approach based on a full-blown messaging component (such as Celery, which uses RabbitMQ). Although that's sexy, it sounds like overkill to me. Some articles suggest setting up a cronjob that executes a script which performs the tasks. But that doesn't feel very attractive either, as it results in creating a new process that loads the entire application into memory, performs some tiny task, and destroys the process again. And this is repeated every 5 minutes. Does not sound like an elegant solution. So, I'm looking for some feedback on my suggested approach as described in the paragraph before the preceeding paragraph. Is my reasoning correct? Am I overlooking (potential) problems? What about my assumption that application's performance will not be impeded?

    Read the article

  • Works using Django development server, but throws import error with Apache using mod_wsgi

    - by Raj
    I have a Django project that works fine with the development server that comes with it. No errors are produced at all when I use "django manage.py runserver" and the app works fine, but when I try to use it with mod_wsgi and Apache the browser displays "Internal Server Error" with a 500 error code and it generates an import error in the Apache error log. Here's the error in the log: ImportError: No module named registration I'm using the Django registration module which is located in a path like this: /opt/raj/photos/registration I know that the registration app is in the path because I can fire up a Python shell, import sys, and get a list of paths using sys.path. Here are some of the paths output from Python shell: sys.path ['', '/opt/raj/pyamf', '/opt/raj', '/opt/raj/pictures', '/opt/raj/pictures /registration', '/usr/lib/python2.6',....] Any thoughts would be appreciated.

    Read the article

  • how to send file via http with python

    - by ep45
    Hello, I have a problem. I use Apache with mod_wsgi and webpy, and when i send a file on http, a lot packets are lost. This is my code : web.header('Content-Type','video/x-flv') web.header('Content-length',sizeFile) f = file(FILE_PATH, 'rb') while True: buffer = f.read(4*1024) if buffer : yield buffer else : break f.close() What in my code is wrong ? thanks.

    Read the article

  • Why am I getting 404 in Django?

    - by alex
    After installing this python Django module: http://code.google.com/p/django-compress/wiki/Installation I am getting 404's in my media static files. This Django module is supposed to "compress" the javascript/css files. That's why I'm getting 404 I guess. The problem is, I don't want this anymore. And when I installed this program, I did "python setup.py install" How do I install it? I just want to revert it back to normal so I don't get any 404 errors.

    Read the article

  • Tilecache standalone server with nginx in production environment

    - by farhan khan
    Hi, I am really new to tilecache. I would like to know how good is the tilecache http server that comes with the tilecache installation. Is it practical to deploy it behind nginx in production environment? (i.e. nohup tilecache_http_server.py -p 8000 & and then editting the nginx.conf). The VPS we are using has nginx installed already so I thought that would be the easiest for me. However, how practical/efficient is it?

    Read the article

  • Getting HTTP GET variables using Tipfy

    - by Vestonian
    Hey everyone, I'm currently playing around with tipfy on Google's Appengine and just recently ran into a problem: I can't for the life of me find any documentation on how to use GET variables in my application, I've tried sifting through both tipfy and Werkzeug's documentations with no success. I know that I can use request.form.get('variable') to get POST variables and **kwargs in my handlers for URL variables, but that's as much as the documentation will tell me. Any ideas?

    Read the article

  • Pushing data once a URL is requested

    - by Eli Grey
    Given, when a user requests /foo on my server, I send the following HTTP response (not closing the connection): Content-Type: multipart/x-mixed-replace; boundary=----------------------- ----------------------- Content-Type: text/html <a href="/bar">foo</a> When the user clicks on foo (which will send 204 No Content so the view doesn't change), I want to send the following data in the initial response. ----------------------- Content-Type: text/html bar How would could I get the second request to trigger this from the initial response? I'm planning on possibly creating a fancy [engines that support multipart/x-mixed-replace (currently only Gecko)]-only email webapp that does server-push and Ajax effects without any JavaScript, just for fun.

    Read the article

  • what do i need to do so that mod_wsgi will find libmysqlclient.16.dylib? (osx 10.7 with apache mod_wsgi)

    - by compound eye
    I am trying to run django on osx 10.7 (lion) with apache mod_wsgi and virtualenv. My site works if I use the django testing server: (baseline)otter:hello mathew$ python manage.py runserver but it doesn't work when I run apache. The core of the error seems to be Library not loaded: libmysqlclient.16.dylib I think its to do with the path apache is using to locate libmysqlclient.16.dylib when I run otool in the lib directory it looks good otter:lib mathew$ pwd /usr/local/mysql/lib otter:lib mathew$ otool -L libmysqlclient.16.dylib libmysqlclient.16.dylib: libmysqlclient.16.dylib (compatibility version 16.0.0, current version 16.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1) but from outside it can't find it otter:lib mathew$ cd / otter:/ mathew$ otool -L libmysqlclient.16.dylib otool: can't open file: libmysqlclient.16.dylib (No such file or directory) if i manually set DYLD_LIBRARY_PATH otool works otter:lib mathew$ DYLD_LIBRARY_PATH=/usr/local/mysql/lib otter:lib mathew$ otool -L libmysqlclient.16.dylib libmysqlclient.16.dylib: libmysqlclient.16.dylib (compatibility version 16.0.0, current version 16.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1) When I run the django testing server, my .bash_profile sets up the virtualenv and the path to the mysql dynamic library export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH export PATH When i run apache it finds my virtualenv paths, but it doesn't seem to find the dynamic library path. I tried adding this path to /usr/sbin/envvars DYLD_LIBRARY_PATH="/usr/lib:/usr/local/mysql/lib:$DYLD_LIBRARY_PATH" export DYLD_LIBRARY_PATH and to /private/etc/paths.d/libmysql /usr/local/mysql/lib then restarted the machine but that has not changed the error message. Error loading MySQLdb module: dlopen(/usr/local/python_virtualenv/baseline/lib/python2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.16.dylib I don't think is a permissions issue: -rwxr-xr-x 1 root wheel 3787328 4 Dec 2010 libmysqlclient.16.dylib drwxr-xr-x 39 root wheel 1394 18 Nov 21:07 / drwxr-xr-x@ 15 root wheel 510 24 Oct 22:10 /usr drwxrwxr-x 20 root admin 680 2 Nov 20:22 /usr/local drwxr-xr-x 20 mathew admin 680 9 Nov 21:58 /usr/local/python_virtualenv drwxr-xr-x 6 mathew admin 204 2 Nov 21:36 /usr/local/python_virtualenv/baseline drwxr-xr-x 4 mathew admin 136 2 Nov 21:26 /usr/local/python_virtualenv/baseline/lib drwxr-xr-x 52 mathew admin 1768 2 Nov 21:26 /usr/local/python_virtualenv/baseline/lib/python2.7 drwxr-xr-x 18 mathew admin 612 4 Nov 21:20 /usr/local/python_virtualenv/baseline/lib/python2.7/site-packages -rwxr-xr-x 1 mathew admin 66076 2 Nov 21:18 /usr/local/python_virtualenv/baseline/lib/python2.7/site-packages/_mysql.so What do i need to do so that mod_wsgi will find libmysqlclient.16.dylib? apache and mysql are both 64 bit: otter:lib mathew$ file /usr/sbin/httpd /usr/sbin/httpd: Mach-O universal binary with 2 architectures /usr/sbin/httpd (for architecture x86_64): Mach-O 64-bit executable x86_64 /usr/sbin/httpd (for architecture i386): Mach-O executable i386 otter:lib mathew$ otter:lib mathew$ file /usr/local/mysql/lib/libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib: Mach-O 64-bit dynamically linked shared library x86_64

    Read the article

  • Is there a /users/www-data type directory in RedHat/Fedora?

    - by Yarin
    I'm trying to setup web2py on my Fedora server, and the instructions, written for Debian, are telling me to install it in the /users/www-data directory. I realize that Fedora uses a default 'apache' user for running Apache, and Debian uses a 'www-data' user, but there's no corresponding /users/apache directory on my machine... Here are the instructions http://web2py.com/book/default/section/11/2

    Read the article

  • Django on Dreamhost - testing/sand box environment

    - by elequ
    I've been using webfaction for all my django needs for the last couple of years but have had a high traffic site fall in my lap that dreamhost are probably better suited to handling. To set up and experiment with a site with webfaction there are your [user].webfactional.com accounts. Which is sweet. Equivalently Dreamhost also offers [name].dreamhosters.com Yet this doesn't seem to work with my database and this doesn't seem to be playing nice with setting up django or passenger_wsgi. So I'm wondering if I'm interpreting the documentation correctly to suggest that in order to make a site that depends on passenger it needs to be running from an active domain. The documentation is really implicit, I'm baffled. Has anyone set up a testing/sand box environment for django using dreamhost, or know how to?

    Read the article

  • How do i use repoze.who?

    - by misterwebz
    I'm having some trouble understanding how repoze.who works. I've followed a tutorial i found by searching on google and here's what i already have: This is what i added in my middleware.py file from repoze.who.config import make_middleware_with_config as make_who_with_config app = make_who_with_config(app, global_conf, app_conf['who.config_file'], app_conf['who.log_file'], app_conf['who.log_level']) Here's the who.ini : http://pastebin.com/w5Tba2Fp Here's repoze_auth.py in /lib/auth/: from paste.httpexceptions import HTTPFound from iwant.model import User class UserModelPlugin(object): def authenticate(self, environ, identity): try: username = identity['login'] password = identity['password'] except KeyError: return None success = User.authenticate(username, password) return success def add_metadata(self, environ, identity): username = identity.get('repoze.who.userid') user = User.get(username) if user is not None: identity['user'] = user I've also checked the plugins in the repoze.who folder, but i failed to understand how it's supposed to be used. I'd appreciate it if someone would push me in the right direction.

    Read the article

  • django setup with Apache, mod_wsgi and cx_Oracle

    - by pablo
    Hi, I need to setup the same django project on several identical servers. Details: - os - free edition of oracle enterprise linux 5 - Apache / mod_wsgi - python - custom python2.6 installation - oracle db with cx_Oracle What is the simplest way to set it up? Would you recommend creating a system user for the django project and use daemon mode? What type of user and what privileges does it need? Can I set ORACLE_HOME, LD_LIBRARY_PATH, PATH=$ORACLE_HOME/bin:$PATH for this user? Would you use a virtualenv for cx_Oracle? Can I somehow put the python2.6 inside the virtualenv so it will portable to other servers? Thanks

    Read the article

  • mod_wsgi | linux installation error

    - by MMRUser
    I'm getting the following error when I try to install mod_wsgi ./configure checking for apxs2... no checking for apxs... /usr/sbin/apxs checking Apache version... 2.2.3 configure: creating ./config.status config.status: creating Makefile make /usr/sbin/apxs -c -I/usr/local/include/python2.6 -DNDEBUG mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python2.6/config -lpython2.6 -lpthread -ldl -lutil -lm /apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fno-strict-aliasing -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/local/include/python2.6 -DNDEBUG -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo sh: /apr-1/build/libtool: No such file or directory apxs:Error: Command failed with rc=8323072 . make: *** [mod_wsgi.la] Error 1 libtool is installed on my system.. mod_wsgi 3.2 *Apache 2.2* *Python 2.6*

    Read the article

  • Django admin interface upload failing on request data read error

    - by Jake
    Hi All, This is an updated version of an old question I asked. I've now done a lot more testing, plus the old question got hijacked. I'm getting a request data read error when trying to upload files to the Django admin interface. Files under about 150k work, but bigger files always fail and almost always at around 192k (that's 3 chunks) completed, sometimes at around 160k. The Exception I get is below. File "/usr/lib/python2.4/site-packages/django/http/multipartparser.py", line 405, in read return self._file.read(num_bytes) IOError: request data read error I've tried Chrome and Firefox on Windows and Firefox on Mac - Same results. I can upload to other sites so I don't think it's my connection. I'm running python 2.4, django 1.1, mod_wsgi, on CentOS (a media temple DV server) Locally it's fine (Django development server) Everything I've found on this issue says it's a mod_python issue and that changing to mod_wsgi will fix it, but I am running mod_wsgi. Can anyone help?

    Read the article

  • Can PyAMF support service deployment by way of the filesystem?

    - by Chris R
    I'm evaluating PyAMF to replace our current PHP (ugh) AMF services framework, and I'm unable to find the one crucial piece of information that would allow me to provide a compelling use case for changing over: Right now, new PHP AMF services are deployed simply by putting the .php files in the filesystem; the next time they're accessed, the new service is in play. Removal of a service is as simple as deleting the .php file that provided it, and updating it is correspondingly simple. I need that same ease-of-deployment from PyAMF. If we have to rewrite our installers to deploy these services, it'll be a nonstarter. So, what I need to know is, can PyAMF support new service discovery by way of the filesystem, can it support service upgrading and removal by way of same, and if so, what is the best way to set it up to do this? I'm open to any of the various server options; I can easily have cherrypy, django, whatever installed and running on its own, and even -- with a bit more sturm nd drang -- have mod_python or mod_wsgi made available.

    Read the article

  • mod_wsgi daemon mode vs threaded fastcgi

    - by t0ster
    Can someone explain the difference between apache mod_wsgi in daemon mode and django fastcgi in threaded mode. They both use threads for concurrency I think. Supposing that I'm using nginx as front end to apache mod_wsgi. UPDATE: I'm comparing django built in fastcgi(./manage.py method=threaded maxchildren=15) and mod_wsgi in 'daemon' mode(WSGIDaemonProcess example threads=15). They both use threads and acquire GIL, am I right?

    Read the article

  • django (under mod_wsgi) and php

    - by Hellnar
    Hello Under my debian copy, I run a django site runs via apache2 and mod_wsgi. Now I want to include a wordpress to it, for that I need to install php - apache bindings. I am curious what library is recommended for this, aswell as how shall I be doing the apache2 config file ? Here is my current apache 2 000-default file: <VirtualHost *:80> Alias /media /home/myuser/myproject/statics Alias /favicon.ico /home/myuser/myproject/statics/pic/favicon.ico Alias /robots.txt /home/myuser/myproject/templates/robots.txt Alias /admin_media /usr/lib/python2.5/site-packages/Django-1.1.1-py2.5.egg/django/contrib/admin/media WSGIScriptAlias / /home/myuser/myproject/myproject_wsgi.py WSGIDaemonProcess myproject user=myuser group=myuser threads=25 WSGIProcessGroup myproject </VirtualHost> I want to add Wordpress to my www.mysite.com/blog

    Read the article

  • Setting up repoze.who with make_redirecting_plugin

    - by Timmy
    my file is: [plugin:form] use = repoze.who.plugins.form:make_redirecting_plugin login_form_url = /account/signin login_handler_path = /account/login logout_handler_path = /account/logout [identifiers] plugins = form;browser auth_tkt i created a form on /account/signin, but it doesnt find the identity? what has to be on the form?

    Read the article

  • Apache modules: C module vs mod_wsgi python module - Performance

    - by Gopal
    Hi A client of ours is asking us to implement a module in C in Apache webserver for performance reasons. This module should handle RESTful uri's, access a database and return results in json format. Many people here have recommended python mod_wsgi instead - but for simplicity of programming reasons. Can anyone tell me if there is a significant difference in performance between the mod_wsgi python solution vs. the Apache + C.module. Any anecdotes? Pointers to some study posted online?

    Read the article

  • Django repeating vars/cache issue?

    - by Mark
    I'm trying to build a better/more powerful form class for Django. It's working well, except for these sub-forms. Actually, it works perfectly right after I re-start apache, but after I refresh the page a few times, my HTML output starts to look like this: <input class="text" type="text" id="pickup_addr-pickup_addr-pickup_addr-id-pickup_addr-venue" value="" name="pickup_addr-pickup_addr-pickup_addr-pickup_addr-venue" /> The pickup_addr- part starts repeating many times. I was looking for loops around the prefix code that might have cause this to happen, but the output isn't even consistent when I refresh the page, so I think something is getting cached somewhere, but I can't even imagine how that's possible. The prefix car should be reset when the class is initialized, no? Unless it's somehow not initializing something? class Form(object): count = 0 def __init__(self, data={}, prefix='', action='', id=None, multiple=False): self.fields = {} self.subforms = {} self.data = {} self.action = action self.id = fnn(id, 'form%d' % Form.count) self.errors = [] self.valid = True if not empty(prefix) and prefix[-1:] not in ('-','_'): prefix += '-' for name, field in inspect.getmembers(self, lambda m: isinstance(m, Field)): if name[:2] == '__': continue field_name = fnn(field.name, name) field.label = fnn(field.label, humanize(field_name)) field.name = field.widget.name = prefix + field_name + ife(multiple, '[]') field.id = field.auto_id = field.widget.id = ife(field.id==None, 'id-') + prefix + fnn(field.id, field_name) + ife(multiple, Form.count) field.errors = [] val = fnn(field.widget.get_value(data), field.default) if isinstance(val, basestring): try: val = field.coerce(field.format(val)) except Exception, err: self.valid = False field.errors.append(escape_html(err)) field.val = self.data[name] = field.widget.val = val for rule in field.rules: rule.fields = self.fields rule.val = field.val rule.name = field.name self.fields[name] = field for name, form in inspect.getmembers(self, lambda m: ispropersubclass(m, Form)): if name[:2] == '__': continue self.subforms[name] = self.__dict__[name] = form(data=data, prefix='%s%s-' % (prefix, name)) Form.count += 1 Let me know if you need more code... I know it's a lot, but I just can't figure out what's causing this!

    Read the article

  • How can i use a commandlinetool (ie. sox) via subprocess.Popen with mod_wsgi?

    - by marue
    I have a custom django filefield that makes use of sox, a commandline audiotool. This works pretty well as long as i use the django development server. But as soon as i switch to the production server, using apache2 and mod_wsgi, mod_wsgi catches every output to stdout. This makes it impossible to use the commandline tool to evaluate the file, for example use it to check if the uploaded file really is an audio file like this: filetype=subprocess.Popen([sox,'--i','-t','%s'%self.path], shell=False,\ stdout=subprocess.PIPE, stderr=subprocess.PIPE) (filetype,error)=filetype.communicate() if error: raise EnvironmentError((1,'AudioFile error while determining audioformat: %s'%error)) Is there a way to workaround for this? edit the error i get is "missing filename". I am using mod_wsgi 2.5, standard with ubuntu 8.04. edit2 What exactly happens, when i call subprocess.Popen from within django in mod_wsgi? Shouldn't subprocess stdin/stdout be independent from django stdin/stdout? In that case mod_wsgi should not affect programms called via subprocess... I'm really confused right now, because the file i am trying to access is a temporary file, created via a filenamevariable that i pass to the file creation and the subprocess command. That file is being written to /tmp, where the rights are 777, so it can't be a rights issue. And the error message is not "file does not exist", but "missing filename", which suggests i am not passing a filename as parameter to the commandlinetool.

    Read the article

  • How do I use multiple settings file in Django with multiple sites on one server?

    - by William Bing Hua
    I have an ec2 instance running Ubuntu 14.04 and I want to host two sites from it. On my first site I have two settings file, production_settings.py and settings.py (for local development). I import the local settings into the production settings and override any settings with the production settings file. Since my production settings file is not the default settings.py name, I have to create an environment variable DJANGO_SETTINGS_MODULE='site1.production_settings' However because of this whenever I try to start my second site it says No module named site1.production_settings I am assuming that this is due to me setting the environment variable. Another problem is that I won't be able to use different settings file for different sites. How do I start use two different settings file for two different websites?

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >