Search Results

Search found 3555 results on 143 pages for 'django reinhardt'.

Page 47/143 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • django-cms lighttpd redirect domain to url

    - by Robert
    Hello, I am using djano-cms for my site, but instead of language alias /en/ /de/ I need to use another domain. I would like to avoid running multiple django instances, and instead I would like to use lighttpd redirects if possible. I would like requests coming to domain2.com getting data from domain.com/en . The best would be if the user entering: domain2.com/offer got transparently data from domain.com/en/offer Tried many solutions with url.redirect, url.rewrite but none seems to work as desired. Also tried with: http://stackoverflow.com/questions/261904/matching-domains-with-regex-for-lighttpd-mod-evhost-www-domain-com-domain-com but that didn't work. Please help. This is my lighttpd configuration. $HTTP["host"] == "^domain2\.com" { url.redirect = ("^/(.*)" => "http://domain.com/en/$1") } $HTTP["host"] =~ "^domain\.com" { server.document-root = "/var/www/django/projects/domain/" accesslog.filename = "/var/log/lighttpd/domain.log-access.log" server.errorlog = "/var/log/lighttpd/www.domain-error.log" fastcgi.server = ( "/domain-service.fcgi" => ( "main" => ( "socket" => "/tmp/django-domain.sock", "check-local" => "disable", ) ), ) alias.url = ( "/media/" => "/var/www/django/projects/domain/media/", ) url.rewrite-once = ( "^(/site_media.*)$" => "$1", "^(/media.*)$" => "$1", "^/favicon\.ico$" => "/media/favicon.ico", "^(/.*)$" => "/domain-service.fcgi$1", } Thanks

    Read the article

  • Using Memcached in Python/Django - questions.

    - by Thomas
    I am starting use Memcached to make my website faster. For constant data in my database I use this: from django.core.cache import cache cache_key = 'regions' regions = cache.get(cache_key) if result is None: """Not Found in Cache""" regions = Regions.objects.all() cache.set(cache_key, regions, 2592000) #(2592000sekund = 30 dni) return regions For seldom changed data I use signals: from django.core.cache import cache from django.db.models import signals def nuke_social_network_cache(self, instance, **kwargs): cache_key = 'networks_for_%s' % (self.instance.user_id,) cache.delete(cache_key) signals.post_save.connect(nuke_social_network_cache, sender=SocialNetworkProfile) signals.post_delete.connect(nuke_social_network_cache, sender=SocialNetworkProfile) Is it correct way? I installed django-memcached-0.1.2, which show me: Memcached Server Stats Server Keys Hits Gets Hit_Rate Traffic_In Traffic_Out Usage Uptime 127.0.0.1 15 220 276 79% 83.1 KB 364.1 KB 18.4 KB 22:21:25 Can sombody explain what columns means? And last question. I have templates where I am getting much records from a few table (relationships). So in my view I get records from one table and in templates show it and related info from others. Generating page last a few seconds for very small table (<100records). Is it some easy way to cache queries from templates? Have I to do some big structure in my view (with all related tables), cache it and send to template?

    Read the article

  • jstree dynamic JSON data from django

    - by danspants
    I'm trying to set up jsTree to dynamically accept JSON data from django. This is the test data i have django returning to jstree: result=[{ "data" : "A node", "children" : [ { "data" : "Only child", "state" : "closed" } ], "state" : "open" },"Ajax node"] response=HttpResponse(content=result,mimetype="application/json") this is the jstree code I'm using: jQuery("#demo1").jstree({ "json_data" : { "ajax" : { "url" : "/dirlist", "data" : function (n) { return { id : n.attr ? n.attr("id") : 0 }; }, error: function(e){alert(e);} } }, "plugins" : [ "themes","json_data"] }); All I get is the ajax loading symbol, the ajax error response is also triggered and it alerts "undefined". I've also tried simpleJson encoding in django but with the same result. If I change the url so that it is receiving a JSON file with identical data, it works as expected. Any ideas on what the issue might be?

    Read the article

  • django ignoring admin.py

    - by noam
    I am trying to enable the admin for my app. I managed to get the admin running, but I can't seem to make my models appear on the admin page. I tried following the tutorial (here) which says: (Quote) Just one thing to do: We need to tell the admin that Poll objects have an admin interface. To do this, create a file called admin.py in your polls directory, and edit it to look like this: from polls.models import Poll from django.contrib import admin admin.site.register(Poll) (end quote) I added an admin.py file as instructed, and also added the following lines into urls.py: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ... (r'^admin/', include(admin.site.urls)), ) but it appears to have no effect. I even added a print 1 at the first line of admin.py and I see that the printout never happens, So I guess django doesn't know about my admin.py. As said, I can enter the admin site, I just don't see anything other than "groups", "users" and "sites". What step am I missing?

    Read the article

  • Which Python API should be used with Mongo DB and Django

    - by Thomas
    I have been going back and forth over which Python API to use when interacting with Mongo. I did a quick survey of the landscape and identified three leading candidates. PyMongo MongoEngine Ming If you were designing a new content-heavy website using the django framework, what API would you choose and why? MongoEngine looks like it was built specifically with Django in mind. PyMongo appears to be a thin wrapper around Mongo. It has a lot of power, though loses a lot of the abstractions gained through using django as a framework. Ming represents an interesting middle ground between PyMongo and MongoEngine, though I haven't had the opportunity to take it for a test drive.

    Read the article

  • Some basic questions about Django, Pyjamas and Clean URLs

    - by Acidburn2k
    I am farily new to the topic, but I am trying to combine both Django and Pyjamas. What would be the smart way to combine the two? I am not asking about communication, but rather about the logical part. Should I just put all the Pyjamas generated JS in the base of the domain, say http://www.mysite.com/something and setup Django on a subdirectory, or even subdomain, so all the JSON calls will go for http://something.mysite.com/something ? As far as I understand now in such combination theres not much point to create views in Django? Is there some solution for clean urls in Pyjamas, or that should be solved on some oy,ther level? How? Is it a standard way to pass some arguments as GET parameteres in a clean url while calling a Pyjamas generated JS?

    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

  • Can't run os.system command in Django?

    - by danspants
    We have a Django app running on apache server (mod_python) on a windows machine which needs to call some r scripts. To do so it would be easiest to call r through os.system, however when django gets to the os.system command it freezes up. I've also tried subprocess with the same result. We have a possibly related problem in that Django can only access the file system of the machine it's on, all network drives appear to be invisible to it, which is VERY frustrating. Any ideas on both of these issues (I'm assuming it's the same limitation in both instances) would be most appreciated.

    Read the article

  • How to customize pickle for django model objects

    - by muudscope
    I need to pickle a complex object that refers to django model objects. The standard pickling process stores a denormalized object in the pickle. So if the object changes on the database between pickling and unpickling, the model is now out of date. (I know this is true with in-memory objects too, but the pickling is a convenient time to address it.) So what I'd like is a way to not pickle the full django model object. Instead just store its class and id, and re-fetch the contents from the database on load. Can I specify a custom pickle method for this class? I'm happy to write a wrapper class around the django model to handle the lazy fetching from db, if there's a way to do the pickling.

    Read the article

  • Correct way to get absolute url in django

    - by dreamiurg
    A problem that I stumbled upon recently, and, even though I solved it, I would like to hear your opinion of what correct/simple/adopted solution would be. I'm developing website using Django + python. When I run it on local machine with "python manage.py runserver", local address is http://127.0.0.1:8000/ by default. However, on production server my app has other url, with path - like "http://server.name/myproj/" I need to generate and use permanent urls. If I'm using {% url view params %}, I'm getting paths that are relative to / , since my urls.py contains this urlpatterns = patterns('', (r'^(\d+)?$', 'myproj.myapp.views.index'), (r'^img/(.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/img' }), (r'^css/(.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/css' }), ) So far, I see 2 solutions: modify urls.py, include '/myproj/' in case of production run use request.build_absolute_uri() for creating link in views.py or pass some variable with 'hostname:port/path' in templates Are there prettier ways to deal with this problem? Thank you.

    Read the article

  • PHP and Django: Nginx, FastCGI and Green Unicorn?

    - by littlejim84
    I'm curious... I'm looking to have a really efficient setup for my slice for a client. I'm not an expert with servers and so am looking for good solid resources to help me set this up... It's been recommended to me that using FastCGI for PHP, Green Unicorn (gunicorn) for Django and Nginx for media is a good combination to have PHP and Django running on the same slice/server. This is needed due to have a main Django website and admin, but also to have a PHP forum on there too. Could anyone push me to some useful resources that would help me set this up on my slice? Or at least, any views or comments on this particular setup?

    Read the article

  • Django : json serialize a queryset which uses defer() or only()

    - by PlanetUnknown
    Now I've been using json serializer and it works great. I had to modify my queries where I started using the only() & defer() filters, like so - retObj = OBJModel.objects.defer("create_dt").filter(loged_in_dt__gte=dtStart) After I've done the above, suddenly the json serializer is returning empty fields - {"pk": 19047, "model": "OBJModel_deferred_create_dt", "fields": {}} If I remove the defer(), the serializer gives all the data correctly. import json from django.utils import simplejson from django.core import serializers json_serializer = serializers.get_serializer("json")() retObj = OBJModel.objects.defer("create_dt").filter(loged_in_dt__gte=dtStart) json_serializer.serialize(retObj, ensure_ascii=False) I've scratched my head on this for a while now. Any insight would be great. NOTE : I am using django 1.1

    Read the article

  • Lost in UTF-8 hell. (Django and Python)

    - by user140314
    I am working through the Django RSS reader project here. The RSS feed will read something like "OKLAHOMA CITY (AP) — James Harden let". The RSS feed's encoding reads encoding="UTF-8" so I believe I am passing utf-8 to markdown in the code snippet below. The em dash is where it chokes. I get the Django error of "'ascii' codec can't encode character u'\u2014' in position 109: ordinal not in range(128)" which is an UnicodeEncodeError. In the variables being passed I see "OKLAHOMA CITY (AP) \u2014 James Harden". The code line that is not working is: content = content.encode(parsed_feed.encoding, "xmlcharrefreplace") I am using markdown 2.0, django 1.1, and python 2.4. What is the magic sequence of encoding and decoding that I need to do to make this work? 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

  • Django query: Count and Group BY

    - by Tyler Lane
    I have a query that I'm trying to figure the "django" way of doing it: I want to take the last 100 calls from Call. Which is easy: calls = Call.objects.all().order_by('-call_time')[:100] However the next part I can't find the way to do it via django's ORM. I want to get a list of the call_types and the number of calls each one has WITHIN that previous queryset i just did. Normally i would do a query like this: "SELECT COUNT(id),calltype FROM call WHERE id IN ( SELECT id FROM call ORDER BY call_time DESC LIMIT 100 ) GROUP BY calltype;" I can't seem to find the django way of doing this particular query. Here are my 2 models: class Call( models.Model ): call_time = models.DateTimeField( "Call Time", auto_now = False, auto_now_add = False ) description = models.CharField( max_length = 150 ) response = models.CharField( max_length = 50 ) event_num = models.CharField( max_length = 20 ) report_num = models.CharField( max_length = 20 ) address = models.CharField( max_length = 150 ) zip_code = models.CharField( max_length = 10 ) geom = models.PointField(srid=4326) calltype = models.ForeignKey(CallType) objects = models.GeoManager() class CallType( models.Model ): name = models.CharField( max_length = 50 ) description = models.CharField( max_length = 150 ) active = models.BooleanField() time_init = models.DateTimeField( "Date Added", auto_now = False, auto_now_add = True ) objects = models.Manager()

    Read the article

  • django : Serving static files through nginx

    - by PlanetUnknown
    I'm using apache+mod_wsgi for django. And all css/js/images are served through nginx. For some odd, reason when others/friends/colleagues try accessing the site, jquery/css is not getting loaded for them, hence the page looks jumbled up. My html files use code like this - <link rel="stylesheet" type="text/css" href="http://x.x.x.x:8000/css/custom.css"/> <script type="text/javascript" src="http://1x.x.x.x:8000/js/custom.js"></script> My nginx configuration in sites-available is like this - server { listen 8000; server_name localhost; access_log /var/log/nginx/aa8000.access.log; error_log /var/log/nginx/aa8000.error.log; location / { index index.html index.htm; } location /static/ { autoindex on; root /opt/aa/webroot/; } } There is a directory /opt/aa/webroot/static/ which have corresponding css & js directories. The odd thing is that the pages show fine when I access them. I have cleared my cache/etc, but the page loads fine for me, from various browsers. Also, I don't see any 404 any error in the nginx log files. Actually the logs for nginx are not getting refreshed at all. I restarted the nginx server using root, is that incorrect ? There is a user www-data defined in the nginx configuration file. Any pointers would be great.

    Read the article

  • Django and mod_python config

    - by Peter
    My Django project is placed in /www/host1/htdocs/my/project, www and my are links to other actual folders. Apache has mod_python enabled. I have a .htaccess in project folder: SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE project.settings PythonDebug On PythonOption django.root /my/project PythonPath "['/www/host1/htdocs/my/project'] + sys.path" I suppose my site should be accessible from http://host1/my/project, but I see the following error: ImportError: Could not import settings 'project.settings' (Is it on sys.path? Does it have syntax errors?): No module named project.settings Can somebody give any suggestions?

    Read the article

  • django app organization

    - by iHeartDucks
    I have been reading some django tutorial and it seems like all the view functions have to go in a file called "views.py" and all the models go in "models.py". I fear that I might end up with a lot of view functions in my view.py file and the same is the case with models.py. Is my understanding of django apps correct? Django apps lets us separate common functionality into different apps and keep the file size of views and models to a minimum? For example: My project can contain an app for recipes (create, update, view, and search) and a friend app, the comments app, and so on. Can I still move some of my view functions to a different file? So I only have the CRUD in one single file?

    Read the article

  • Testing Django web app with Hudson and Selenium

    - by ycseattle
    This might be a newbie question for Hudson. I am trying to setup Selenium testing for my Django website in my Hudson CI server. The question is, the Hudson will use subversion to checkout my Django code into its own path, how do I "deploy" the code into the same server for testing? This is not a question about deploying django, but instead how to access the source file in hudson workspace. Most tutorials/blogs is about building and running tests, but I couldn't find useful information about how to setup the web application on the server to run the test against. 1) Should I write some shell script to copy the source files from the hudson workspace? Is there an environment variable to use to access the workspace? 2) Is there a tutorial on how to grab web app files in hudson workspace and deploy them? I am sure this apply for other technologies like PHP as well. Thanks!

    Read the article

  • integrating django-paypal

    - by ramdaz
    Hi I am trying to integrate Django-Paypal onto a site, where once the customer makes a payment I need to send a dynamic URL from which the user can download some specific information. I am registering all users to a URL which allows them to buy the document. The URL which can only be accessed by a registered user with a verified email ids using django-registration, allows the user to connect to paypal and make payment. How do I capture the signal and verify which user has made the payment for which product he/she is purchased, based on this information 1) I need to know two information, which user made the payment, and for which product did he or she make the payment? 2) Only if I have these information can I send the right UR:L by email. Any help appreciated. I am not very sure how django-signals work. What all details does payment_was_successful signal return? I am using IPN

    Read the article

  • Django doctests in views.py

    - by Brian M. Hunt
    The Django documentation on tests states: For a given Django application, the test runner looks for doctests in two places: The models.py file. You can define module-level doctests and/or a doctest for individual models. It's common practice to put application-level doctests in the module docstring and model-level doctests in the model docstrings. A file called tests.py in the application directory -- i.e., the directory that holds models.py. This file is a hook for any and all doctests you want to write that aren't necessarily related to models. Out of curiosity I'd like to know why Django's testrunner is limited to the doctests in models.py, but more practically I'd like to know how one could expand the testrunner's doctests to include (for example) views.py and other modules when running manage.py test. I'd be grateful for any input. Thank you. Brian

    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

  • django : nginx : jquery css not being served

    - by PlanetUnknown
    I'm using apache+mod_wsgi for django. And all css/js/images are served through nginx. For some odd, reason when others/friends/colleagues try accessing the site, jquery/css is not getting loaded for them, hence the page looks jumbled up. My html files use code like this - <link rel="stylesheet" type="text/css" href="http://x.x.x.x:8000/css/custom.css"/> <script type="text/javascript" src="http://1x.x.x.x:8000/js/custom.js"></script> My nginx configuration in sites-available is like this - server { listen 8000; server_name localhost; access_log /var/log/nginx/aa8000.access.log; error_log /var/log/nginx/aa8000.error.log; location / { index index.html index.htm; } location /static/ { autoindex on; root /opt/aa/webroot/; } } There is a directory /opt/aa/webroot/static/ which have corresponding css & js directories. The odd thing is that the pages show fine when I access them. I have cleared my cache/etc, but the page loads fine for me, from various browsers. Also, I don't see any 404 any error in the nginx log files. Actually the logs for nginx are not getting refreshed at all. I restarted the nginx server using root, is that incorrect ? There is a user www-data defined in the nginx configuration file. Any pointers would be great.

    Read the article

  • Best Approach to process images in Django

    - by primalpop
    I've have an application with Android front end and Django as the back end. As part of the answers here, I'm confused over the approach which I should take to send images to Django Server. I've 2 options at my disposal as Piro pointed out there. 1) Sending images as Multi Part entity 2) Send image as a String after encoding it using Base 64. So I am considering the approach that would make it easy to be processed by Django. The images are small in size (<200kb) and number (<10). Any suggestions or pointers are most welcome.

    Read the article

  • Django crash without message

    - by schneck
    Hi there, I have a Django-project which was running fine, until I made "some changes" I don't remember exactly. Since that point, on every request, my project crashes silently: $ ./manage.py runserver -v2 Validating models... 0 errors found Django version 1.1.1, using settings 'src.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. After I requested a page (admin oder frontend), it returns to the prompt. I did not find any other option to get verbose output than -v2 - is there any logfile I can use? I'm using Django 1.1.1 on a Mac OS X 10.6 with virtualenv, Python 2.6 Thanks a lot.

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >