Question - sound files and Django.
All, I have a question for the list. I am thinking about making a small website for a friend - a singer/songwriter - that will allow him to embed soundfiles for download and/or streaming by others. I'd like to provide a nice "admin" interface for him so that he can upload his mp3s (or similar) when he feels like it. Naturally, I thought of Django. :-) To this end, I am interested in finding out if anyone has created a "SoundField" class for Django to store and stream sound files - analogous to how the "ImageField" class allows Django to store and display image files. I would also like to know if there are ready made template tags for sound files. Has anyone tackled this? As someone said, I would rather not re-invent the wheel. (And if it hasn't been tackled, well, I better get cracking on it.) Cheers, Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unicode and localized characters in view
On Mar 4, 4:45 pm, Joakim Hove wrote: > About every once a year I am forced out on the internet to read about > "encodings and such"; while reading about it all makes sense, but when > actually trying to get things to work I always go through a period of > swearing and frustration - I never really get it :-( > > > 2. I just entered the 'å' in the Python source code for the view. Then > a get a Python run.-time error stating that I must declare an encoding > when using non-ASCII characters. I then tried declaring the encoding > 'latin-1' in the top of the source file of the view, this gave a > UnicodeDecodeError triggered by Django: > > 'ascii' codec can't decode byte 0xe5 in position 14: ordinal > not in range(128) > > Any hints? Joakin, If your editor can handle utf-8, then perhaps use the utf-8 encoding: #!/usr/bin/python #-*- coding: UTF-8 -*- Another pitfall you might have is that you are using the str rather than the unicode type. Don't forget to declare your string constants with a u in front. For example: problem_child = u"å". I hope this helps. Best regards, Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: dumping data in utf-8
Andreo: Technically, it is utf-8. I am guessing that you want to see actual Cyrillic characters, rather than escape sequence equivalents. The behavior you are seeing is due to PyYAML, the parser used by Django for YAML fixtures. By default, it produces YAML with Unicode escape sequences - a little irritating to those from non-ASCII environments. This isn't a issue with PyYAML - this is an issue with how Django calls it. For the time being, you could try this code with all YAML produced: import yaml; stream = file("fixture_with_undesirable_escaping.yaml", "r"); Loaded = yaml.load(stream); otherstream = file("fixture_with_lovely_ukrainian_characters.yaml", "w"); yaml.dump(Loaded, otherstream, allow_unicode=True); This gets you something like: - fields: {description: 'Украи́на (укр. Україна[ukrɑˈ'} Which is what you want. Best regards, Peter On Apr 10, 10:14 pm, Andreo wrote: > I dump datga: > ./manage.py dumpdata --format=yaml appname > initial_data.yaml > > The result is: > - fields: {description: "\u0423\u043A\u0440\u0430\u0438\u0301\u043D > \u0430 (\u0443\ > \u043A\u0440. \u0423\u043A\u0440\u0430\u0457\u043D\u0430 > [ukr\u0251\u02C8\ > > How to configure django to save data in utf-8? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Homakov-esque Django Vulnerabilities
On Mar 7, 10:13 am, Donald Stufft wrote: > > For what it's worth in the context of the Homakov exploit, this has been a > well known vulnerability by the rails core for years > that they've basically said "not our problem, configure your app better" the > entire time. I think that situation is the one that > Joey was referring too. I hope that Django has no vulnerabilities of the "WTFitude" that Ruby on Rails has with "mass assignment" vulnerabilities. I got this link from Homakov's github complaint[1]. http://enlightsolutions.com/articles/whats-new-in-edge-scoped-mass-assignment-in-rails-3-1 "If you’re using Rails and you want to be secure, you should be protecting against mass assignment. Basically, without declaring attr_accessible or attr_protected, malicious users can set any column value in your database, including foreign keys and secure data." Huh? (With a side helping of jaw dropping.) Why would you allow your users to get anywhere near the DB code? Why should it be even possible? Why would "magic" attributes make a difference? In Django, you abstract the models code (which reads and writes DB records) from the views (where all the monkey business could occur) from the urls. At least that's what I thought you should do. You also make the views in charge of checking whether your requests are POSTs or GETs. Okay, this depends on the programmer to do the right thing, but programmers are encouraged to do the right thing by the framework. You could set up a vulnerability that allows attackers to add every British PM in your Users model (from Walpole to Cameron) via a GET request. But you'd have to sabotage your own code to do so. Or am I missing something? Best regards, Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Python FAQ: Webdev
All, This may be a link of interest to the list. The site "Fuzzy Notepad" recently wrote an article absolutely, absolutely slating PHP [*]. So the question was asked: "I only know PHP. How do I write a Web application in Python? "This is a deeply complex question. I could easily fill a book on web development and Python and how to make the two interact, so I was hoping to put this one off for a while. But given that I just trashed PHP rather harshly, it seems prudent to answer it sooner rather than later..." http://me.veekun.com/blog/2012/05/05/python-faq-webdev/ The site recommends "Flask" by the way - not Django. The author thinks it is too heavyweight for his or her uses. But there seems to be a lot of ideas in the article about how to make a framework that seem to be captured in Django. Best regards, Peter [* http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ ] -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: A very basic question with Django
On Wednesday, October 10, 2012 3:24:26 PM UTC+10, Sarbjit singh wrote: > > First of all, I am very sorry for asking this basic question. I am not > sure if this is the right place to put this question but I am very confused. > > Hello, Sarbjit. > I am not having much experience with web development, so i don't know > where the Django fits in here. I searched a lot on internet, few forums > suggested to use Django for websites and few mentioned that Django is not > for web development. So i have couple of basic questions and i want to be > sure that i am on right track in learning Django. > > Be careful of forums. On some places, it's the "blind leading the blind". "Where does Django fit in"? It fits in on the server machine. A HTTP server program (like Apache or nginx) takes web page requests, and passes them onto Django. In turn, Django interprets the requests, generally running queries on the database and doing whatever processing is necessary to generate a web page. Django then throws the generated web page to the HTTP server, which then sends it back to the web browser. Django has a development server where you can request and receive pages without something like Apache or nginx. But this is not recommended in a production environment, because it is a lot slower. Django is used for generating content dynamically; but there is no gain in using development server to fetch static files (like images). > Q: There are simple websites which just serves static contents and other > site which deals with forms and data base. I have once used PHP for form > processing and using it with DB. If i have to design such websites using > Python, Is Django suitable for the following or there are some other > modules which needs to be used. > > If everything is static, then Django is overkill. All you need is your favorite HTTP server. But if you are dealing with forms and databases, then Django is very, very suitable indeed. There are classes in the framework that allow you to create forms on the fly. As for databases, there are also classes that allow you to model the database tables and run queries _without writing any SQL_. Do you really want to write your own SQL statements? I don't. You asked "are there some other modules which needs to be used?" Well, you need Python to run it; Django won't work without it. But other "modules" you may need are modules written in Python - and they can be installed as simply as running "pip install " from the command line. One of the best things about Django is that a lot of security is built in by default. You can write something and be fairly confident that all the attack vectors have been blocked off. SQL injections? Not a problem; the model classes do all the hard work of passing queries to the database and _escaping content_. Cross Site Request Forgeries? The form classes prevent such things occurring. > Q: Is Django a substitute to CGI for dynamic web generation. > > It sounds better than bog standard CGI, where every request spawns a new process. > Q: Can i use Django for development of a full fledged website. > > > Of course you can. Best regards, Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/GcI_d9S8bYMJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Social Networking basics? -Raj
+1 for Fabián's link. Not only is it better-tempered than ESR on the subject, it's a lot _shorter_. I like how it is split into 10 simple sections. Love points 4, 5 and 6! Not everyone on this list has English as a first language. Some newcomers may be confused or daunted by Eric's lengthy prose, and thus missing the point altogether. But I think Mike Ash's work can be skimmed to get the gist. Cheers, Peter On Jun 24, 12:17 pm, Fabian Ezequiel Gallina wrote: > > I find this document[0] to be really nice, helpful and without that > particular tone. > > Someone from Python Argentina (PyAR) translated it to Spanish and it > is what we use to guide newcomers. > > [0]http://www.mikeash.com/getting_answers.html > > Regards, > -- > Fabián E. Gallinahttp://www.anue.biz -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Looking for recomendation on using popup like admin "+" widget
GKR, If I understand you correctly, you want to override the behavior of a Field.choices property, so that admins can add values on the fly. I don't think that is possible with Django. Maybe the best solution is to create a new table with one column - one that contains only the choices admins want for particular fields in a parent model. And then use the magic of InlineModelAdmin objects to embed that table in the parent tables's admin page. https://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects Is this of assistance? Best regards, Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: questionnaire
On Jun 27, 5:52 pm, Venkatraman S wrote: > On Mon, Jun 27, 2011 at 12:19 PM, Coulson Thabo Kgathi > wrote: > > > want to create a questionnaire and answers such that one question > > appears on the screen at a time and once the answers is selected then > > the it's saved then the next question is shown the answers to the > > questions are strictly radio butoons or drop down menu this will be > > used for a survey on notebook touch screens. please help > > Write one? Coulson, That's probably the best advice you are going to get. You're going to have to do it yourself - dive into HTML and get cracking. This list is about Django, a Web framework written in Python. You're question is so broad that it sounds like you're asking people to _design_ the whole website for you. That may not be what you intended to convey, but that's what it feels like. If you intent to do your website through Django, please try to research it as much as possible yourself. Then if your come across an issue than you can't resolve, please have a read of this before replying to the list: http://www.mikeash.com/getting_answers.html I'd also give some personal advice. It's harder to understand people when they leave out punctuation. Periods and commas make your meaning more clear, which makes other people more able to help you. Best regards, Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: questionnaire
On Jun 27, 8:30 pm, Coulson Thabo Kgathi wrote: > ok > Coulsen, This is a far better response. [Code snipped, but it gave me an idea of where you are coming from. ;-] > urlpatterns = patterns('', > # Example: > # (r'^questionSite/', include('questionSite.foo.urls')), > #(r'^questions/(?P\d+)/$', 'questions.views.detail'), > # Uncomment the admin/doc line below and add 'django.contrib.admindocs' > #(r'^admin/doc/', include('django.contrib.admindocs.urls')), > # to INSTALLED_APPS to enable admin documentation: > > # Uncomment the next line to enable the admin: > (r'^admin/', include(admin.site.urls)), > ) > > so this gives me a questionnaire but i kind of hard coded the question and i > am not using my own templete but i want to use my own templete, of which i > suppose i will nid to use the views file and may other file so that is what > i am failing to do. I think you've identified the problem. You have 'question.views.details' as your view function, but you haven't supplied the source for it. Which I believe means you _have_ to write it, and the template that goes with it. One thing I would add: from a user-friendliness point of view, it might be better to have the questions in one page, or at most 5. Hitting "Next" 21 times is a turn off for most people. But you know your needs best. Best regards, Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: WindowsError 32
Domdom, The first thing to do is Google|Bing|Other Search Engine of your choice "WindowsError 32". If you had done that, the first link: http://msdn.microsoft.com/en-us/library/ms681382%28v=vs.85%29.aspx Would have given you a clue: ERROR_SHARING_VIOLATION 32 (0x20): The process cannot access the file because it is being used by another process. I think the issue is that your code is trying to delete a file when it is being accessed by something else. Perhaps you forgot to close it elsewhere? Best regards, Peter On Jul 11, 9:53 pm, bruno desthuilliers wrote: > On Jul 11, 7:53 am, Domdom wrote: > > > Hello! When I try to delete file from django on windows sometimes I > > meet error page WindowsError 32. > > What is WindowsError 32 ? (believe it or else, but quite a few people > here never use this particular OS). > > > My model calls this method every fore > > every delete: > > > def delete(self, using=None): > > super(UserFile, self).delete(using) > > self.fileobject.close() > > self.fileobject.storage.delete(self.fileobject) > > What is self.fileobject ? > > > I tried a lot of variants, but error appears with every varient. > > ProgrammingByPermutation is a well-known antipattern (http:// > en.wikipedia.org/wiki/Programming_by_permutation). Better to > understand exactly WHY your code fail, so you have a chance to know > why it works once you have the problem fixed. > > > I found, that it is Windows/python bug. > > Do you mean that you found a link to a ticket about this exact problem > in a bugtracking system? Or that you only have this problem under > Windows ? > > > My project will be working under > > the linux, but I need to develop and test it under the windows. I do > > not know what to do :-( > > Please start here:https://code.djangoproject.com/wiki/UsingTheMailingList > > then come back with enough detailed informations about your problem. > > HTH -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Real Example
Eyad, Well, I'll be damned: http://www.djangosites.org/with-source/ It's good etiquette to say "thank you" at this point. ;-) Best regards, Peter On Jul 23, 4:17 am, Phang Mulianto wrote: > you better find books in amazon. .. many ready to learn for you.. > On Jul 22, 2011 10:41 PM, "Shawn Milochik" wrote:> On > 07/22/2011 10:31 AM, Eyad Al-Sibai wrote: > >> Hi! > > >> I want a real example of complete django application with source code > >> to understand django better > > > 1. Search Google, github, and bitbucket. > > > 2. Read this:https://code.djangoproject.com/wiki/UsingTheMailingList > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group.> To post to this group, send email to > django-users@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com.> For more options, visit this > group at > > http://groups.google.com/group/django-users?hl=en. > > > > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Best & Easiest Python/Django Forum App to install
Wildcard, Have you checked DjangoPackages? More Forum apps than you can poke a stick at, and all compared for features supported: http://djangopackages.com/grids/g/forums/ Best regards, Peter On Jul 26, 8:37 am, wildcard wrote: > I would like some steering in my planning so that I am headed in the > right direction, concerning Django Forum apps and where to find them, > as I am a bit lost looking for them. > > I have built my first server (Debian). I've used OpenVZ which appears > to work great and allows me now to create websites. I want to use > Python as my language of choice, which I am learning also, (and since > I only want to learn one language) I want all the apps I pick to be > Python based as Python impresses me the most. > > I have selected the Satchmo app for my eCommerce needs, which uses > Django, and since that framework will already be installed (and I only > want to learn one framework :) ) I am looking for a python and/or > Django based FORUM to implement.and hopefully one that is pretty > much ready to go after the install, or requires little to no > programming to set up. > > My needs in a forum are pretty simple: > Only members can post, but everyone > can read > Registration- > Case Sensitive Passwords > email click link to activate > email notification of reply option > Subscribe to Thread option (email notification) > Views count > Replies count > Search Forum for matching threads > > It would also be nice if I could put this forum in it's own VE > container and use it for multiple types of forums which are not > apparent to each other, thus users coming in on separate links only > see the forum they chose to visit from other specialized VE > containers.is that possible? > > Thanks for your help! I am pretty excited about Django and Python! :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Django for a front end designer
If you are thinking about diving into PHP, I suggest you read this first: http://www.tbray.org/ongoing/When/200x/2006/02/17/PHP It's five years old, but it contains a lot of links to pro- and anti- PHP rants, which you should consider. (Consider also that there's no good Unicode support inside PHP even after this time.) Personally, reading it was enough for me to dive into Python instead. But you may feel differently. Another thing you should consider: sometimes programming languages such as Python can be used for web-related things that aren't just running a web server. Take screen-scraping: taking an existing website of a client, and extracting its content for your use. There are libraries available with Python like BeautifulSoup that allow you to handle malformed HTML and scrape it into what ever file format you want. Then you can use Django's admin functionality to load the file into your database, making a new Django-powered website for your client! How would you screen-scrape in PHP? Is it even possible? Before reading the Django tutorial, read the Python tutorial, and see if the language is right for you or not: http://docs.python.org/tutorial/ Whatever your decision, good luck! Best regards, Peter -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.