Search Results

Search found 15813 results on 633 pages for 'django settings'.

Page 41/633 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Right way to have a thread in parallel to django project on wsgi.

    - by Enrico Carlesso
    Hi guys. I'm writing a django project, and I need to have a parallel thread which performs certain tasks. The project will be deployed in Apache2.2 with mod_wsgi. Actually my implementation consists on a thread with a while True - Sleep which is called from my django.wsgi file. Is this implementation correct? Two problems raises: does django.wsgi get called only once? Will I have just that instance of the thread running? And second, I need to "manually" visit at least a page to have the Thread run. Is there a workaround? Does anyone has some hints on better solutions? Thanks in advance.

    Read the article

  • Django admin panel doesn't work after modify default user model.

    - by damienix
    I was trying to extend user profile. I founded a few solutions, but the most recommended was to create new user class containing foreign key to original django.contrib.auth.models.User class. I did it with this so i have in models.py: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) website_url = models.URLField(verify_exists=False) and in my admin.py from django.contrib import admin from someapp.models import * from django.contrib.auth.admin import UserAdmin # Define an inline admin descriptor for UserProfile model class UserProfileInline(admin.TabularInline): model = UserProfile fk_name = 'user' max_num = 1 # Define a new UserAdmin class class MyUserAdmin(UserAdmin): inlines = [UserProfileInline, ] # Re-register UserAdmin admin.site.unregister(User) admin.site.register(User, MyUserAdmin) And now when I'm trying to create/edit user in admin panel i have an error: "Unknown column 'content_userprofile.id' in 'field list'" where content is my appname. I was trying to add line AUTH_PROFILE_MODULE = 'content.UserProfile' to my settings.py but with no effect. How to tell panel admin to know how to correctly display fields in user form?

    Read the article

  • Timeout settings for Remote Desktop Sessions to lock

    - by atroon
    Our office uses a Windows 2003 server to provide access to an accounting application. Recently I was asked to increase the amount of time it takes for the session to lock itself and require the entry of the user's password to resume. That seems to be about ten minutes, at present. I am familiar with group policy and have tweaked those settings to scavenge sessions (and thereby licenses) from sessions that have been disconnected (by the user closing the mstsc.exe client or by a network issue). That's simple and straightforward. But I can't find anything in GP to allow a longer time period before the RDP client window goes black and then, when clicked upon, requires a username and password to resume the session. I must admit this would be nice personally as well, since most of my time is spent documenting the application and/or monitoring its database, so I usually have a window open to the terminal server along with the rest of the staff in the accounting center, but I interact with it very little. I usually enter my password 10-15 times per workday, but I'm pretty good at it by now. ;) So, can this timeout period be adjusted, or are we out of luck?

    Read the article

  • How do I restore the privacy pane of the system settings?

    - by Sparhawk
    Checking out screenshots of the system settings in Ubuntu 12.10, it seems that I am missing a few. When I open up my settings, I cannot see Privacy, Backup, and Management Service. Also, nothing comes up when I search the Dash for these words. In a previous edition of Ubuntu, I purged Ubuntu One (with sudo apt-get purge ubuntuone-client python-ubuntuone-storage* ubuntuone-couch ubuntuone-installer) and appropriately, I cannot see the Ubuntu One icon. I've also previously purged unity-lens-music Perhaps I purged some metapackage that removed the others? In any case, how do I restore the privacy pane (as well as the other icons)? Also, any suggestions for what I did to remove the packages in the first place (and hence how to avoid this problem in the future)?

    Read the article

  • Django - The included urlconf doesn't have any patterns in it

    - by unsorted
    My website, which was working before, suddenly started breaking with the error "ImproperlyConfigured at / The included urlconf resume.urls doesn't have any patterns in it" The project base is called resume. In settings.py I have set ROOT_URLCONF = 'resume.urls' Here's my resume.urls, which sits in the project root directory. from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^resume/', include('resume.foo.urls')), # Uncomment the admin/doc line below and add 'django.contrib.admindocs' # to INSTALLED_APPS to enable admin documentation: (r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: (r'^admin/', include(admin.site.urls)), (r'^accounts/login/$', 'django.contrib.auth.views.login'), #(r'^employer/', include(students.urls)), (r'^ajax/', include('urls.ajax')), (r'^student/', include('students.urls')), (r'^club/(?P<object_id>\d+)/$', 'resume.students.views.club_detail'), (r'^company/(?P<object_id>\d+)/$', 'resume.students.views.company_detail'), (r'^program/(?P<object_id>\d+)/$', 'resume.students.views.program_detail'), (r'^course/(?P<object_id>\d+)/$', 'resume.students.views.course_detail'), (r'^career/(?P<object_id>\d+)/$', 'resume.students.views.career_detail'), (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'C:/code/django/resume/media'}), ) Anyone know what's wrong? This is driving me crazy. Thanks,

    Read the article

  • Django Image Upload: IOErrno2 Could not find path -- and yet it's saving the image there anyway?

    - by Rob
    I have an issue where the local version of django is handling image upload as expected but my server is not. Note: I am using a Django Container on MediaTemple.net (grid server) Here is my code. def view_settings(request): <snip> if request.POST: success_msgs = () mForm = MainProfileForm(request.POST, request.FILES, instance = mProfile) pForm = ChangePasswordForm(request.POST) eForm = ChangeEmailForm(request.POST) if mForm.is_valid(): m = mForm.save(commit = False) if mForm.cleaned_data['avatar']: m.avatar = upload_photo(request.FILES['avatar'], settings.AVATAR_SAVE_LOCATION) m.save() success_msgs += ('profile pictured updated',) <snip> def upload_photo(data,saveLocation): savePath = os.path.join(settings.MEDIA_ROOT, saveLocation, data.name) destination = open(savePath, 'wb+') for chunk in data.chunks(): destination.write(chunk) destination.close() return os.path.join(saveLocation, data.name) Here's where it gets whacky and I was hoping someone could shed a light on this error, because either a) it's the wrong error code, or b) something is happening with the file before it's completely handled. To recap, the file was actually uploaded to the server in the intended directory - and yet this err msg continues to persist. IOError at /user/settings [Errno 2] No such file or directory: u'/home/user66666/domains/example.com/html/media/images/avatars/DSC03852.JPG' Environment: Request Method: POST Request URL: http://111.111.111.111:2011/user/settings Django Version: 1.0.2 final Python Version: 2.4.4 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'ctrlme', 'usertools', 'easy_thumbnails'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File "/home/user6666/containers/django/leonidas/usertools/views.py" in view_settings m.avatar = upload_photo(request.FILES['avatar'], settings.AVATAR_SAVE_LOCATION) File "/home/user666666/containers/django/leonidas/usertools/functions.py" in upload_photo destination = open(savePath, 'wb+')

    Read the article

  • Django generic relation field reports that all() is getting unexpected keyword argument when no args

    - by Joshua
    I have a model which can be attached to to other models. class Attachable(models.Model): content_type = models.ForeignKey(ContentType) object_pk = models.TextField() content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") class Meta: abstract = True class Flag(Attachable): user = models.ForeignKey(User) flag = models.SlugField() timestamp = models.DateTimeField() I'm creating a generic relationship to this model in another model. flags = generic.GenericRelation(Flag) I try to get objects from this generic relation like so: self.flags.all() This results in the following exception: >>> obj.flags.all() Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 105, in all return self.get_query_set() File "/usr/local/lib/python2.6/dist-packages/django/contrib/contenttypes/generic.py", line 252, in get_query_set return superclass.get_query_set(self).filter(**query) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 498, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 516, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1675, in add_q can_reuse=used_aliases) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1569, in add_filter negate=negate, process_extras=process_extras) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1737, in setup_joins "Choices are: %s" % (name, ", ".join(names))) FieldError: Cannot resolve keyword 'object_id' into field. Choices are: content_type, flag, id, nestablecomment, object_pk, timestamp, user >>> obj.flags.all(object_pk=obj.pk) Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: all() got an unexpected keyword argument 'object_pk' What have I done wrong?

    Read the article

  • Installing django on dreamhost (help a newb out)

    - by augustfirst
    I'm trying to get django running on my dreahost account. I've been trying to sort of use two tutorials at once: the one on the dreamhost wiki and the one in the django book. I installed django using the script on the wiki page, but I ran into trouble immediately while trying to work through the django book. It says: To start the server, change into your project directory (cd mysite), if you haven’t already, and run this command: python manage.py runserver This launches the server locally, on port 8000, accessible only to connections from your own computer. Now that it’s running, visit 127.0.0.1:8000 with your Web browser. You’ll see a “Welcome to Django” page shaded in a pleasant pastel blue. It worked! Those instructions seem to assume that you're developing locally, not on a shared server. Where the heck am I supposed to look for the "Welcome to Django" page after starting the server? In my webroot? No dice. Anyway, I tried to blunder ahead through the django book to its hello world tutorial (chapter 3). But once I've edited the view file and the URLconf, I don't get a nice clean "hello world" text. Instead (as you can see) I get an "import error". Any help would be greatly appreciated.

    Read the article

  • Need help with Django tutorial

    - by Nai
    I'm doing the Django tutorial here: http://docs.djangoproject.com/en/1.2/intro/tutorial03/ My TEMPLATE_DIRS in the settings.py looks like this: TEMPLATE_DIRS = ( "/webapp2/templates/" "/webapp2/templates/polls" # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) My urls.py looks like this: from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^polls/$', 'polls.views.index'), (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'), (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'), (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'), (r'^admin/', include(admin.site.urls)), ) My views.py looks like this: from django.template import Context, loader from polls.models import Poll from django.http import HttpResponse def index(request): latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] t = loader.get_template('c:/webapp2/templates/polls/index.html') c = Context({ 'latest_poll_list': latest_poll_list, }) return HttpResponse(t.render(c)) I think I am getting the path of my template wrong because when I simplify the views.py code to something like this, I am able to load the page. from django.http import HttpResponse def index(request): return HttpResponse("Hello, world. You're at the poll index.") My index template file is located at C:/webapp2/templates/polls/index.html. What am I doing wrong?

    Read the article

  • django wsgi multiple projects different url same apache server

    - by Thomas Schultz
    Hello, I'm trying to get 2 separate django projects running on the same apache server with mod_wsgi that are also under the same domain but different urls. Like www.example.com/site1/ and www.example.com/site2 What I'm trying to do is something like... <VirtualHost *:80> ServerName www.example.com <location "/site1/"> DocumentRoot "/var/www/html/site1" WSGIScriptAlias / /var/www/html/site1/django.wsgi </location> <location "/site2/"> DocumentRoot "/var/www/html/site2" WSGIScriptAlias / /var/www/html/site2/django.wsgi </location> </VirtualHost> The closes thing I've seen is this http://docs.djangoproject.com/en/dev/howto/deployment/modpython/ but "mysite" is different for both of these cases and they're using mod_python instead of mod_wsgi. Any help with this would be great thanks!

    Read the article

  • Django HttpResponseRedirect acting as proxy rather than 302

    - by Trevor Burnham
    I have a Django method that's returning return HttpResponseRedirect("/redirect-target") When running the server locally, if I visit the page that returns that redirect, I get the log output [17/Oct/2013 15:26:02] "GET /redirecter HTTP/1.1" 302 0 [17/Oct/2013 15:26:02] "GET /redirect-target HTTP/1.1" 404 0 as expected. But, when I visit that page in Chrome, the Network tab shows the request to /redirecter with the response from /redirect-target, rather than showing the 302. cURL does the same: $ curl -I -X GET http://localhost/redirecter HTTP/1.1 404 Not Found date: Thu, 17 Oct 2013 19:32:30 GMT connection: keep-alive transfer-encoding: chunked In production, the same Django code does show a 302 redirect in Chrome and cURL. What could be going on here? Is there some kind of Django setting that might be causing it to proxy the target rather than send a redirect when HttpResponseRedirect is used (but lie about it in the log)? Or is there a quirk on my system (OS X) that might cause localhost redirects to behave this way?

    Read the article

  • Django fails to find static files served by nginx

    - by Simon
    I know this is a really noobish question but I can't find any solution despite finding the problem trivial. I have a django application deployed with gunicorn. The static files are served by the nginx server with the following url : myserver.com/static/admin/css/base.css. However, my django application keep looking for the static files at myserver.com:8001/static/admin/css/base.css and is obviously failing (404). I don't know how to fix this. Is it a django or an nginx problem ? Here is my nginx configuration file : server { server_name myserver.com; access_log off; location /static/ { alias /home/myproject/static/; } location / { proxy_pass http://127.0.0.1:8001; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Real-IP $remote_addr; add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; } } Thanks for the help !

    Read the article

  • gevent with Django as daemon

    - by jonathonmorgan
    I've been developing an app using django_socketio (a python port of the Node equivalent), which relies on gevent. It ships with a Django management command that runs gevent's pywsgi server, but that of course stops when I close my terminal window, just like Django's dev server. This is a proof of concept, and there's no expectation that it would hold up in a production environment, but I'd like to have the server at least "permanently" process HTTP requests, so I don't need to manually start the dev server in order to demo. I'm assuming I need to run this as a daemon process, but prior to this I've only used apache and mod_wsgi, so unsure of where to begin, or even how I would go about starting a daemon. I found gevent-spawn, which looks promising, but it's unclear to me how that code is executed. Basically, how would I use gevent to serve a Django app in a setting without manually starting/stopping the server?

    Read the article

  • Deploy multiple django instances on one Host [migrated]

    - by tvn
    I am trying to setup multiple Django instances on one Host with lighttpd. My problem is to get Djangos FCGI working on subdirectories served by my Webserver. So my aim is the following: www.myhost.org/django0 - django1.fcgi on localhost:3000 www.myhost.org/django1 - django2.fcgi on localhost:3001 www.myhost.org/django2 - django3.fcgi on localhost:3002 Unfortunately the following configuration doesn't even work for one: $HTTP["url"] =~ "^/django0/static($|/)" { server.document-root = "/home/django0/django/static/" } $HTTP["url"] =~ "^/django0/media($|/)" { server.document-root = "/usr/lib/python2.7/dist-packages/django/contrib/admin/media/" } $HTTP["url"] =~ "^/django0($|/)" { proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => "3001", "check-local" => "disable", ) ) ) } The only response I get is an 404 and even this takes a long time till I get this. I found nothing suspicious neither in the access.log nor in the error.log.

    Read the article

  • MVVM Binding to Properties.Settings

    - by LnDCobra
    In a MVVM approach how would I go about binding to Properties.Settings? Is there a way to bind a property in C# code(in the ViewModel) to another property(Properties.Settings.Default) or should i just bind to standard properties and on save make sure each property gets propogated manually to the Properties.Settings?

    Read the article

  • One admin for multiple sites

    - by valya
    I have two sites with different SITE_IDs, but I want to have only one admin interface for both sites. I have a model, which is just an extended FlatPage: # models.py class SFlatPage(FlatPage): currobjects = CurrentSiteManager('sites') galleries = models.ManyToManyField(Gallery) # etc # admin.py class SFlatPageAdmin(FlatPageAdmin): fieldsets = None admin.site.register(SFlatPage, SFlatPageAdmin) admin.site.unregister(FlatPage) I don't know why, but there are only pages for current site in admin interface. On http://site1.com/admin/ I see flatpages for site1, on http://site2.com/admin/ I see flatpages for site2. But I want to see all pages in http://site1.com/admin/ interface! What am I doing wrong?

    Read the article

  • Best way to change Satchmo checkout page fields?

    - by konrad
    For a Satchmo project we have to change the fields a customer has to fill out during checkout. Specifically, we have to: Add a 'middle name' field Replace the bill and delivery addressee with separate first, middle and last name fields Replace the two address lines with street, number and number extension These fields are expected by an upstream web service, so we need to store this data separately. What's the best way to achieve this with minimal changes in the rest of Satchmo? We prefer a solution in which we do not have to change the Satchmo code itself, but if required we can fork it.

    Read the article

  • Django1.1 model field value preprocessing before returning

    - by Satoru.Logic
    Hi, all. I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content = NoteContentField(max_length=256) NoteContentField is a custom sub-class of CharField that override the to_python method in purpose of doing some twitter-text-conversion processing. class NoteContentField(models.CharField): __metaclass__ = models.SubfieldBase def to_python(self, value): value = super(NoteContentField, self).to_python(value) from ..utils import linkify return mark_safe(linkify(value)) However, this doesn't work. When I save a Note object like this: note = Note(author=request.use, content=form.cleaned_data['content']) note.save() The conversed value is saved into the database, which is not what I wanna see. What I'm trying to do is to save the raw content into the database, and only make the conversion when the content attribute is later accessed. Would you please tell me what's wrong with this? Thanks to Pierre and Daniel. I have figured out what's wrong. I thought the text-conversion code should be in either to_python or get_db_prep_value, and that's wrong. I should override both of them, make to_python do the conversion and get_db_prep_value return the unconversed value: from ..utils import linkify class NoteContentField(models.CharField): __metaclass__ = models.SubfieldBase def to_python(self, value): self._raw_value = super(NoteContentField, self).to_python(value) return mark_safe(linkify(self._raw_value)) def get_db_prep_value(self, value): return self._raw_value I wonder if there is a better way to implement this?

    Read the article

  • Get list of Unique many-to-many records from a queryset

    - by rsp
    My models: class Order(models.Model): ordered_by = models.ForeignKey(User) reasons = models.ManyToManyField(Reason) class Reason(models.Model): description = models.CharField() Basically a user creates an order and gives reasons for that order. ie, john has two orders (one for pencils because he is out AND because he doesn't like his current stock. a second order for pens because he is out). I want to print a list out of all reasons a user has placed his orders. So under john, it should print "he is out", "he doesn't like his current stock"; those two lines only. If I simply select all of john's orders, iterate through them and print out their "reasons" it'll print "he is out", "he doesn't like his current stock" and then "he is out" again. I don't want these duplicate values. How do I select a list of his reasons for ALL his orders so that the list has all unique rows?

    Read the article

  • MVVM- How would I go about propagating settings between my main view-model (and other view-models) a

    - by Justin
    I am building a settings dialog for my application and right now all of the settings correspond with settings on the main view-model, but as I add more view's and view-models some may not. I need to know what the best practice is for loading the current settings into the settings dialog and then saving the settings to thier corresponding view-models if the user clicks okay. I will not be using the Properties.Settings.Default system to store settings since I want my application to be as portable as possible and this would store user scoped settings in the directory: C:\Users\ username \Local Settings\Application Data\ ApplicationName Instead of in my application's directory. In case it makes any difference I am using the MVVM Light Toolkit by Laurent Bugnion.

    Read the article

  • raw_id_fields for modelforms

    - by nbv4
    I have a modelform which has one field that is a ForeignKey value to a model which as 40,000 rows. The default modelform tries to create a select box with 40,000 options, which, to say the least is not ideal. Even more so when this modelform is used in a formset factory! In the admin, this is easiely avoidable by using "raw_id_fields", but there doesn't seem to be a modelform equivalent. How can I do this? Here is my modelform: class OpBaseForm(ModelForm): base = forms.CharField() class Meta: model = OpBase exclude = ['operation', 'routes'] extra = 0 raw_id_fields = ('base', ) #does nothing The first bolded line works by not creating the huge unwieldy selectbox, but when I try to save a fieldset of this form, I get the error: "OpBase.base" must be a "Base" instance. In order for the modelform to be saved, 'base' needs to be a Base instance. Apparently, a string representation of a Base primary key isn't enough (at least not automatically). I need some kind of mechanism to change the string that is given my the form, to a Base instance. And this mechanism has to work in a formset. Any ideas? If only raw_id_fields would work, this would be easy as cake. But as far as I can tell, it only is available in the admin.

    Read the article

  • Processing file uploads before object is saved

    - by Dominic Rodger
    I've got a model like this: class Talk(BaseModel): title = models.CharField(max_length=200) mp3 = models.FileField(upload_to = u'talks/', max_length=200) seconds = models.IntegerField(blank = True, null = True) I want to validate before saving that the uploaded file is an MP3, like this: def is_mp3(path_to_file): from mutagen.mp3 import MP3 audio = MP3(path_to_file) return not audio.info.sketchy Once I'm sure I've got an MP3, I want to save the length of the talk in the seconds attribute, like this: audio = MP3(path_to_file) self.seconds = audio.info.length The problem is, before saving, the uploaded file doesn't have a path (see this ticket, closed as wontfix), so I can't process the MP3. I'd like to raise a nice validation error so that ModelForms can display a helpful error ("You idiot, you didn't upload an MP3" or something). Any idea how I can go about accessing the file before it's saved? p.s. If anyone knows a better way of validating files are MP3s I'm all ears - I also want to be able to mess around with ID3 data (set the artist, album, title and probably album art, so I need it to be processable by mutagen).

    Read the article

  • Added tagging to existing model, now how does its admin work?

    - by Oli
    I wanted to add a StackOverflow-style tag input to a blog model of mine. This is a model that has a lot of data already in it. class BlogPost(models.Model): # my blog fields try: tagging.register(BlogPost) except tagging.AlreadyRegistered: pass I thought that was all I needed so I went through my old database of blog posts (this is a newly ported blog) and copied the tags in. It worked and I could display tags and filter by tag. However, I just wrote a new BlogPost and realise there's no tag field there. Reading the documentation (coincidentally, dry enough to be used as an antiperspirant), I found the TagField. Thinking this would just be a manager-style layer over the existing tagging register, I added it. It complained about there not being a Tag column. I'd rather not denormalise on tags just to satisfy create an interface for inputting them. Is there a TagManager class that I can just set on the model? tags = TagManager() # or somesuch

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >