Search Results

Search found 7702 results on 309 pages for 'django validation'.

Page 77/309 | < Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >

  • A comprehensive regex for phone number validation

    - by Nicholas Trandem
    I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: 1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901 I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.

    Read the article

  • Data types for validation

    - by nevalu
    How to create a new data type which to can check/validate its schema when is created a new variable (of that type)? By example, to validate if a string has 20 characters, I tried: {{{ // Format: 2006-01-12T06:06:06Z func date(str string) { if len(str) != 20 { fmt.Println("error") } } var Date = date() type Account struct { domain string username string created Date } }}} but it faills because Date is not a type.

    Read the article

  • asp.net multiple textbox validation

    - by Zaps
    Hi, I currently have 3 textbox controls on my page. I also have a required valdiator of each of the textboxes. However I only want the validator for a textbox to fire if there is text in either of the other 2 textboxes. If all 3 textboxes are empty then no validators should fire. Is there any way I can do this in javascript/jquery as I want the user to get the best experience possible. Any help would be greatly appreciated. Thanks in advance.

    Read the article

  • Can I improve my validation?

    - by Qmal
    So I want to validate my form using jQuery, this is how I imagine it and it works, but is the best method of doing it and maybe I can do it more effective with less code? <script type="text/javascript"> $(document).ready(function() { $("#frmCatAdd").submit(function() { var name = $("#edtName").val(); if (name == "") $("#edtName").css("border", "1px solid red") else $("#frmCatAdd").submit(); return false; }); }); </script>

    Read the article

  • Customise Validation summary

    - by cpoDesign
    I have used html.ValidationSummary to get all errors displayed on top of the page. This will render list with errors on top of the page. Example: <ul> <li>UserName is invalid</li> </ul> I have how ever need to render every item instead of list as custom div with additional html tags inside. such as short example below: <div> <div class="right"><a href="#closeError">Close error</div> <div class="right"><a href="#Update">Update Field</div> <label>Error:</label> Name on the page is invalid. </div> What is your opininon how to achieve this rendering? I have considered to create html helper where i will take ModelState and get all errors, but not sure this will work...

    Read the article

  • I'm an experienced PHP programmer, how would it be for me to learn and use Django and Ruby on Rails?

    - by João Paulo Apolinário Passos
    I'm an experienced PHP programmer, I still have lots to learn but I consider myself experienced. I sometimes use pure PHP and sometimes some framework like CodeIgniter. I always wanted to learn new technologies like Python and Ruby, and their best frameworks for web are Django and Ruby on Rails, but I want to ask to persons like me who migrated from PHP to some of this technologies if is it worth it; Thank you

    Read the article

  • How do you write Valid XHTML 1.0 Strict code when you are using javascript to fill an element that r

    - by Tim Visher
    I'm running my site through the W3C's validator trying to get it to validate as XHTML 1.0 Strict and I've gotten down to a particularly sticky (at least in my experience) validation error. I'm including certain badges from various services in the site that provide their own API and code for inclusion on an external site. These badges use javascript (for the most part) to fill an element that you insert in the markup which requires a child. This means that in the end, perfectly valid markup is generated, but to the validator, all it sees is an incomplete parent-child tag which it then throws an error on. As a caveat, I understand that I could complain to the services that their badges don't validate. Sans this, I assume that someone has validated their code while including badges like this, and that's what I'm interested in. Answers such as, 'Complain to Flickr about their badge' aren't going to help me much. An additional caveat: I would prefer that as much as possible the markup remains semantic. I.E. Adding an empty li tag or tr-td pair to make it validate would be an undesirable solution, even though it may be necessary. If that's the only way it can be made to validate, oh well, but please lean answers towards semantic markup. As an example: <div id="twitter_div"> <h2><a href="http://twitter.com/stopsineman">@Twitter</a></h2> <ul id="twitter_update_list"> <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/stopsineman.json?callback=twitterCallback2&amp;count=1"></script> </ul> </div> Notice the ul tags wrapping the javascript. This eventually gets filled in with lis via the script, but to the validator it only sees the unpopulated ul. Thanks in advance!

    Read the article

  • jquery validate: focusCleanup: true and focusInvalid: false don't work as expected

    - by laramichaels
    I am using Joern's jquery validation plugin 1.6. My goal is to have the following behavior: remove the error message for an element once the user focuses it. From what I understand setting 'focusCleanup: true' should take care of this. However (at least on my browser (Firefox 3.5.7 on Linux)), I only get the desired behavior (ie, error message for a field disappearing once you focus it) if I click into the field; it doesn't handle tabbing into the field correctly. Sample code: HTML: <form id='abc' name='abc'> <input type="text" id="t1" name="t1"/> <input type="text" id="t2" name="t2"/> <input type="submit" id="submit" value='submit'/> </form> JS: $("#abc").validate({ focusCleanup: true, focusInvalid: false, rules: {t1: {required: true, email:true}, t2: {required: true,email:true}} }); I am setting 'focusInvalid: false' because the docs say one should avoid combining focusCleanup and focusInvalid; in my experience commenting out that line makes no difference. Am I doing something wrong?

    Read the article

  • A potentially dangerous Request.Form value was detected: Dealing with these errors proactively, or a

    - by Albert
    I'm noticing this error more and more in my error logs. I've read through the questions here talking about this error, but they don't address what I would like to do (see below). I'm considering three options, in the order of preference: 1) When submitting a form (I use formviews almost exclusively, if that helps), if potentially dangerous characters are detected, automatically strip them out and submit. 2) When submitting a form, if potentially dangerous characters are detected, alert the user and let them fix it before trying again. 3) After the exception is generated, deal with it and alert the user. I'm hoping one of the first two options might be able to do somewhat globally...I know for the 3rd I'd have to alter a TON of Try-Catch blocks I already have in place. Doable, but labor intensive. I'd rather be proactive about it if at all possible and avoid the exception all together. Perhaps one approach to #1 would be to write a block of code that could loop through all text entry fields in a formview, during the insert/update event, and strip the characters out. I'm ok with that, but I'd rather not have to heavily alter all my Insert/Update events to accomplish this. Or maybe I just create a different class to do the text checking/deleting, and only insert 1 line of code in each Insert/Update event. If anyone can come up with some example code of any of these approaches that would be a help. Thanks for any ideas or information. I'm definitely open to other solutions too; these are only the 3 that came to mind. I can say that I don't want to turn request validation off though.

    Read the article

  • Prohibit ampersand in Rails form

    - by snlsn
    NOT a Rails 3 issue In a Contact model I have a company_name attribute. For reasons that don't matter to this question, I want to prohibit an ampersand character. We have a lot of clients with ampersands in their company name, and users forget they aren't allowed to use this character. This isn't an html sanitize issue. I don't care about whitespace or CDATA or anything. The entries in this field are plain text and I don't want an ampersand to be entered in this one field in any way, shape or form. I assume a validation on the model is the way to go. I have tried validates_exclusion_of. I have tried validates_format_of. No success. I'm unsophisticated when it comes to regex, so I might be doing things very wrong. But the bottom line is - I need to prevent a user from entering that "&" character in the company_name field. Thanks a million. Steve

    Read the article

  • python manage.py runserver fails

    - by Randy Simon
    I am trying to learn django by following along with this tutorial. I am using django version 1.1.1 I run django-admin.py startproject mysite and it creates the files it should. Then I try to start the server by running python manage.py runserver but here is where I get the following error. Traceback (most recent call last): File "manage.py", line 11, in <module> execute_manager(settings) File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 362, in execute_manager utility.execute() File "/Library/Python/2.6/site-packages/django/core/management/__init__.py", line 303, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv self.execute(*args, **options.__dict__) File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 213, in execute translation.activate('en-us') File "/Library/Python/2.6/site-packages/django/utils/translation/__init__.py", line 73, in activate return real_activate(language) File "/Library/Python/2.6/site-packages/django/utils/translation/__init__.py", line 43, in delayed_loader return g['real_%s' % caller](*args, **kwargs) File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 205, in activate _active[currentThread()] = translation(language) File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 194, in translation default_translation = _fetch(settings.LANGUAGE_CODE) File "/Library/Python/2.6/site-packages/django/utils/translation/trans_real.py", line 172, in _fetch for localepath in settings.LOCALE_PATHS: File "/Library/Python/2.6/site-packages/django/utils/functional.py", line 273, in __getattr__ return getattr(self._wrapped, name) AttributeError: 'Settings' object has no attribute 'LOCALE_PATHS' Now, I can add a LOCALE_PATH atribute and set to an empty tuple to my settings.py file but then it just complains about another setting and so on. What am I missing here?

    Read the article

  • Django - How to do CSFR on public pages? Or, better yet, how should it be used period?

    - by orokusaki
    After reading this: http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#how-to-use-it I came to the conclusion that it is not valid to use this except for when you trust the person who is using the page which enlists it. Is this correct? I guess I don't really understand when it's safe to use this because of this statement: This should not be done for POST forms that target external URLs, since that would cause the CSRF token to be leaked, leading to a vulnerability. The reason it's confusing is that to me an "external URL" would be on that isn't part of my domain (ie, I own www.example.com and put a form that posts to www.spamfoo.com. This obviously can't be the case since people wouldn't use Django for generating forms that post to other people's websites, but how could it be true that you can't use CSRF protection on public forms (like a login form)?

    Read the article

  • Django: A Result Specific Numeration for Pagination.

    - by TheLizardKing
    Simply put I want what http://www.reddit.com/ and http://news.ycombinator.com/ have to the left of every link. A numerated link starting with 1 and continuing to the next page by means of pagination. I really enjoy using generic views and their built-in pagination for Django and it seems to allow me access to these values if I was on page 3 with 2 items per page. {'MEDIA_URL': ''} {'LANGUAGES': '<<languages>>', 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': 'en-us'} {'debug': True, 'sql_queries': '<<sql_queries>>'} {'messages': [], 'perms': <django.core.context_processors.PermWrapper object at 0xadedeec>, 'user': <User: thelizardking>} {'first_on_page': 5, 'has_next': True, 'has_previous': True, 'hits': 7, 'is_paginated': True, 'last_on_page': 6, 'links_list': [<Link: Funky Town>, <Link: Apple Jax>], 'next': 4, 'page': 3, 'page_obj': <Page 3 of 4>, 'page_range': [1, 2, 3, 4], 'pages': 4, 'paginator': <django.core.paginator.Paginator object at 0xadf914c>, 'previous': 2, 'results_per_page': 2} I know there is an add filter for templates but that's as close as I think I can get and that really doesn't do what I want. Am I going to have to use a custom template filter here or is there something I am not seeing?

    Read the article

  • How to reset ASP.NET MVC client validation mode?

    - by Morten Christiansen
    I'm having a bit of trouble with the client-side validation in the ASP.NET MVC 2 framework and hope someone can help me out. In several situations I find it useful to be able to reset the contents of a form or just a single input element and I need any validation errors to disappear. This in itself is not very hard, and the suggestion provided here works well enough: http://stackoverflow.com/questions/2798427/how-do-i-clear-mvc-client-side-validation-errors-when-a-cancel-button-is-clicked The problem is that, when triggered, client validation goes into an aggressive mode that performs validation on each key press and when an input loses focus. Is there a good way to reset this state as well?

    Read the article

  • django customizing form labels

    - by Henri
    I have a problem in customizing labels in a Django form This is the form code in file contact_form.py: from django import forms class ContactForm(forms.Form): def __init__(self, subject_label="Subject", message_label="Message", email_label="Your email", cc_myself_label="Cc myself", *args, **kwargs): super(ContactForm, self).__init__(*args, **kwargs) self.fields['subject'].label = subject_label self.fields['message'].label = message_label self.fields['email'].label = email_label self.fields['cc_myself'].label = cc_myself_label subject = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) message = forms.CharField(widget=forms.Textarea(attrs={'rows':15, 'cols':80})) email = forms.EmailField(widget=forms.TextInput(attrs={'size':'60'})) cc_myself = forms.BooleanField(required=False) The view I am using this in looks like: def contact(request, product_id=None): . . . if request.method == 'POST': form = contact_form.ContactForm(request.POST) if form.is_valid(): . . else: form = contact_form.ContactForm( subject_label = "Subject", message_label = "Your Message", email_label = "Your email", cc_myself_label = "Cc myself") The strings used for initializing the labels will eventually be strings dependent on the language, i.e. English, Dutch, French etc. When I test the form the email is not sent and instead of the redirect-page the form returns with: <QueryDict: {u'cc_myself': [u'on'], u'message': [u'message body'], u'email':[u'[email protected]'], u'subject': [u'test message']}>: where the subject label was before. This is obviously a dictionary representing the form fields and their contents. When I change the file contact_form.py into: from django import forms class ContactForm(forms.Form): """ def __init__(self, subject_label="Subject", message_label="Message", email_label="Your email", cc_myself_label="Cc myself", *args, **kwargs): super(ContactForm, self).__init__(*args, **kwargs) self.fields['subject'].label = subject_label self.fields['message'].label = message_label self.fields['email'].label = email_label self.fields['cc_myself'].label = cc_myself_label """ subject = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) message = forms.CharField(widget=forms.Textarea(attrs={'rows':15, 'cols':80})) email = forms.EmailField(widget=forms.TextInput(attrs={'size':'60'})) cc_myself = forms.BooleanField(required=False) i.e. disabling the initialization then everything works. The form data is sent by email and the redirect page shows up. So obviously something the the init code isn't right. But what? I would really appreciate some help.

    Read the article

  • Django "login() takes exactly 1 argument (2 given)" error

    - by Oleksandr Bolotov
    I'm trying to store the user's ID in the session using django.contrib.auth.login . But it is not working not as expected. I'm getting error login() takes exactly 1 argument (2 given) With login(user) I'm getting AttributeError at /login/ User' object has no attribute 'method' I'm using slightly modifyed example form http://docs.djangoproject.com/en/dev/topics/auth/ : from django.shortcuts import render_to_response from django.contrib.auth import authenticate, login def login(request): msg = [] if request.method == 'POST': username = request.POST['u'] password = request.POST['p'] user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) msg.append("login successful") else: msg.append("disabled account") else: msg.append("invalid login") return render_to_response('login.html', {'errors': msg}) there's nothing special about login.html: <html> <head> <title></title> </head> <body> <form action="/login/" method="post"> Login:&nbsp; <input type="text" name="u"> <br/> Password:&nbsp; <input type="password" name="p"> <input type="submit" value="Login"> </form> {% if errors %} <ul> {% for error in errors %} <li>{{ error }}</li> {% endfor %} </ul> {% endif %} </body> </html> Does anybody have idea how to make login() work.

    Read the article

  • manage.py runserver throws an ImportError with my appname, MacPorts issue on OSX?

    - by christmasgorilla
    I've been developing a Django app for weeks locally on OSX 10.6.3. Recently, I rebooted my machine and went to start my development environment up. Here's the error: cm:myApp cm$ python manage.py runserver Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/Library/Python/2.6/site-packages/django/core/management/init.py", line 360, in execute_manager setup_environ(settings_mod) File "/Library/Python/2.6/site-packages/django/core/management/init.py", line 343, in setup_environ project_module = import_module(project_name) File "/Library/Python/2.6/site-packages/django/utils/importlib.py", line 35, in import_module import(name) ImportError: No module named myapp I'm pretty new to Django / Python. Digging around, it's possible that this might be due to MacPorts. Initially, I had a rough time getting Django up and running and I no longer remember if I'm using the Django from a MacPorts install or from easy_install. How do I tell? (I'd prefer not to reinstall everything). Also, why is the camel casing in my app name gone in the ImportError message? When I search for "myapp" in my django project, I don't find it without camelcase anywhere. And what causes MacPorts to work for a while but then break? As a few other details, from settings.py: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'south', 'registration', 'pypaypal', 'notifier', 'myApp.batches', )

    Read the article

  • JSON Serialization of a Django inherited model

    - by Simon Morris
    Hello, I have the following Django models class ConfigurationItem(models.Model): path = models.CharField('Path', max_length=1024) name = models.CharField('Name', max_length=1024, blank=True) description = models.CharField('Description', max_length=1024, blank=True) active = models.BooleanField('Active', default=True) is_leaf = models.BooleanField('Is a Leaf item', default=True) class Location(ConfigurationItem): address = models.CharField(max_length=1024, blank=True) phoneNumber = models.CharField(max_length=255, blank=True) url = models.URLField(blank=True) read_acl = models.ManyToManyField(Group, default=None) write_acl = models.ManyToManyField(Group, default=None) alert_group= models.EmailField(blank=True) The full model file is here if it helps. You can see that Company is a child class of ConfigurationItem. I'm trying to use JSON serialization using either the django.core.serializers.serializer or the WadofStuff serializer. Both serializers give me the same problem... >>> from cmdb.models import * >>> from django.core import serializers >>> serializers.serialize('json', [ ConfigurationItem.objects.get(id=7)]) '[{"pk": 7, "model": "cmdb.configurationitem", "fields": {"is_leaf": true, "extension_attribute_10": "", "name": "", "date_modified": "2010-05-19 14:42:53", "extension_attribute_11": false, "extension_attribute_5": "", "extension_attribute_2": "", "extension_attribute_3": "", "extension_attribute_1": "", "extension_attribute_6": "", "extension_attribute_7": "", "extension_attribute_4": "", "date_created": "2010-05-19 14:42:53", "active": true, "path": "/Locations/London", "extension_attribute_8": "", "extension_attribute_9": "", "description": ""}}]' >>> serializers.serialize('json', [ Location.objects.get(id=7)]) '[{"pk": 7, "model": "cmdb.location", "fields": {"write_acl": [], "url": "", "phoneNumber": "", "address": "", "read_acl": [], "alert_group": ""}}]' >>> The problem is that serializing the Company model only gives me the fields directly associated with that model, not the fields from it's parent object. Is there a way of altering this behaviour or should I be looking at building a dictionary of objects and using simplejson to format the output? Thanks in advance ~sm

    Read the article

  • Javascript with Django?

    - by Rosarch
    I know this has been asked before, but I'm having a hard time setting up JS on my Django web app, even though I'm reading the documentation. I'm running the Django dev server. My file structure looks like this: mysite/ __init__.py MySiteDB manage.py settings.py urls.py myapp/ __init__.py admin.py models.py test.py views.py templates/ index.html Where do I want to put the Javascript and CSS? I've tried it in a bunch of places, including myapp/, templates/ and mysite/, but none seem to work. From index.html: <head> <title>Degree Planner</title> <script type="text/javascript" src="/scripts/JQuery.js"></script> <script type="text/javascript" src="/media/scripts/sprintf.js"></script> <script type="text/javascript" src="/media/scripts/clientside.js"></script> </head> From urls.py: (r'^admin/', include(admin.site.urls)), (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': 'media'}) (r'^.*', 'mysite.myapp.views.index'), I suspect that the serve() line is the cause of errors like: TypeError at /admin/auth/ 'tuple' object is not callable Just to round off the rampant flailing, I changed these settings in settings.py: MEDIA_ROOT = '/media/' MEDIA_URL = 'http://127.0.0.1:8000/media'

    Read the article

  • Django: Serving Media Behind Custom URL

    - by TheLizardKing
    So I of course know that serving static files through Django will send you straight to hell but I am confused on how to use a custom url to mask the true location of the file using Django. http://stackoverflow.com/questions/2681338/django-serving-a-download-in-a-generic-view but the answer I accepted seems to be the "wrong" way of doing things. urls.py: url(r'^song/(?P<song_id>\d+)/download/$', song_download, name='song_download'), views.py: def song_download(request, song_id): song = Song.objects.get(id=song_id) fsock = open(os.path.join(song.path, song.filename)) response = HttpResponse(fsock, mimetype='audio/mpeg') response['Content-Disposition'] = "attachment; filename=%s - %s.mp3" % (song.artist, song.title) return response This solution works perfectly but not perfectly enough it turns out. How can I avoid having a direct link to the mp3 while still serving through nginx/apache? EDIT 1 - ADDITIONAL INFO Currently I can get my files by using an address such as: http://www.example.com/music/song/1692/download/ But the above mentioned method is the devil's work. How can I accomplished what I get above while still making nginx/apache serve the media? Is this something that should be done at the webserver level? Some crazy mod_rewrite? http://static.example.com/music/Aphex%20Twin%20-%20Richard%20D.%20James%20(V0)/10%20Logon-Rock%20Witch.mp3

    Read the article

  • Using Pylint with Django

    - by rcreswick
    I would very much like to integrate pylint into the build process for my python projects, but I have run into one show-stopper: One of the error types that I find extremely useful--:E1101: *%s %r has no %r member*--constantly reports errors when using common django fields, for example: E1101:125:get_user_tags: Class 'Tag' has no 'objects' member which is caused by this code: def get_user_tags(username): """ Gets all the tags that username has used. Returns a query set. """ return Tag.objects.filter( ## This line triggers the error. tagownership__users__username__exact=username).distinct() # Here is the Tag class, models.Model is provided by Django: class Tag(models.Model): """ Model for user-defined strings that help categorize Events on on a per-user basis. """ name = models.CharField(max_length=500, null=False, unique=True) def __unicode__(self): return self.name How can I tune Pylint to properly take fields such as objects into account? (I've also looked into the Django source, and I have been unable to find the implementation of objects, so I suspect it is not "just" a class field. On the other hand, I'm fairly new to python, so I may very well have overlooked something.) Edit: The only way I've found to tell pylint to not warn about these warnings is by blocking all errors of the type (E1101) which is not an acceptable solution, since that is (in my opinion) an extremely useful error. If there is another way, without augmenting the pylint source, please point me to specifics :) See here for a summary of the problems I've had with pychecker and pyflakes -- they've proven to be far to unstable for general use. (In pychecker's case, the crashes originated in the pychecker code -- not source it was loading/invoking.)

    Read the article

  • Django apache-wsgi configuration problem

    - by omat
    Hi, I am trying to get my Django project running on the production server. I setup the environment using pip, so it is identical to the development environment where everything is running fine. The only difference is that I don't use virtualenv on production, because this project is the only one that is going to run on production. Also on production, there is an Nginx reverse proxy to serve static content, and passes dynamic requests to Apache2. The Apache wsgi file is as follows: import sys, os sys.path.append('/home/project/src') os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() When I access the server, I get an import error: ImproperlyConfigured: Error importing middleware middleware: "cannot import name UserProfile" Which refers to the middleware.py under src/ folder which is referred by the settings. But I can import both the middleware and the UserProfile class from within ./manage.py shell prompt. It seems like a problem with paths in wsgi file but I cannot see what. The directory structure is: /home/project /home/project/src (which contains the settings.py, middleware.py and app folders) /home/apache/apache.wsgi Any help is greatly appreciated. Thanks, oMat

    Read the article

  • problems doing the Django tutorial on Dreamhost using Passengers

    - by Pietro Speroni
    I have looked and I could not find this question before, and it surprises me. I am reasonably proficient in Python, and I used Dreamhost for a number of years. Now I would like to learn Django. They are finally supporting it using Passenger. Which I do not know what is. Following the instructions on Dreamhost I installed Django. Then I started following the tutorial 01. This went well, except that I could not start the server (this in the tutorial) since the code was live on dreamhost. At the time this did not seem to make any difference. Then when I went on the second part of the tutorial I had to access the admin site. And it worked well going to myurl/admin/ , as it should. But here the problems started. According to the tutorial (here) I have to add a file in the poll application and then restart the server. But I never started the server in the first place, my code is running live on the web... but when I add a file the website the admin acts as if it does not see it. Probably dreamhost has started its own server, and I don't know how to restart it. But I assume this is going to be a common problem when you run django on dreamhost. Every time you add a file you will have to tell the server to consider it. So what should I do to let the server know about it? Thanks, Pietro

    Read the article

  • Django sitemap intermittent www

    - by Jen Z
    The automatic sitemap for my Django site fluctuates between including the www on urls and leaving it out (I'm aiming to have it in all the time). This has ramifications in google not indexing my pages properly so I'm trying to narrow down what would be causing this issue. I have set PREPEND_WWW = True and my site record in the sites framework is set to include the www e.g. it's set to www.example.com as opposed to example.com. I'm using memcached but pages should expire from the cache after 48 hours so I wouldn't have thought that would be causing the issue? You can see the problem in effect at http://www.livingspaceltd.co.uk/sitemap.xml (refresh the page a few times). My sitemaps setup is fairly prosaic so I'm doubtful that that is the issue, but in case it's something obvious I'm missing here's the code: ***urls.py*** sitemaps = { 'subpages': Subpages_Sitemap, 'standalone_pages': Standalone_Sitemap, 'categories': Categories_Sitemap, } urlpatterns = patterns('', (r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}), ... ***sitemaps.py*** # -*- coding: utf-8 -*- from django_ls.livingspace.models import Page, Category, Standalone_Page, Subpage from django.contrib.sitemaps import Sitemap class Subpages_Sitemap(Sitemap): changefreq = "monthly" priority = 0.4 def items(self): return Subpage.objects.filter(restricted_to__isnull=True) class Standalone_Sitemap(Sitemap): changefreq = "weekly" priority = 1 def items(self): return Standalone_Page.objects.all() class Categories_Sitemap(Sitemap): changefreq = "weekly" priority = 0.7 def items(self): return Category.objects.all()

    Read the article

  • Django does not load internal .css files

    - by Rubén Jiménez
    I have created a Django project in local which runs without any kind of problem. But, after an annoying and difficult Cherokee + uWSGI installation on Amazon AWS, my project does not show Django .css internal files. http://f.cl.ly/items/2Q2W3I3R0X1n2X3v0q2P/django_error.jpg <-- /Admin/ looks like The image is a screen of my /admin/, which should have a different style, but .css files are not loaded. [pid: 23206|app: 0|req: 19/19] 83.49.10.217 () {56 vars in 1121 bytes} [Sun Apr 15 05:50:24 2012] GET /static/admin/css/base.css = generated 2896 bytes in 6 msecs (HTTP/1.1 404) 1 headers in 51 bytes (1 switches on core 0) [pid: 23206|app: 0|req: 20/20] 83.49.10.217 () {56 vars in 1125 bytes} [Sun Apr 15 05:50:24 2012] GET /static/admin/css/login.css = generated 2899 bytes in 5 msecs (HTTP/1.1 404) 1 headers in 51 bytes (1 switches on core 0) This is a log from Cherokee. I don't understand why it is looking for the .css files in that path. Cherokee should be searching the files in Django original directory so i didn't change .css files in my project. Any advice? Thanks a lot.

    Read the article

< Previous Page | 73 74 75 76 77 78 79 80 81 82 83 84  | Next Page >