Title
stringlengths 11
150
| A_Id
int64 518
72.5M
| Users Score
int64 -42
283
| Q_Score
int64 0
1.39k
| ViewCount
int64 17
1.71M
| Database and SQL
int64 0
1
| Tags
stringlengths 6
105
| Answer
stringlengths 14
4.78k
| GUI and Desktop Applications
int64 0
1
| System Administration and DevOps
int64 0
1
| Networking and APIs
int64 0
1
| Other
int64 0
1
| CreationDate
stringlengths 23
23
| AnswerCount
int64 1
55
| Score
float64 -1
1.2
| is_accepted
bool 2
classes | Q_Id
int64 469
42.4M
| Python Basics and Environment
int64 0
1
| Data Science and Machine Learning
int64 0
1
| Web Development
int64 1
1
| Available Count
int64 1
15
| Question
stringlengths 17
21k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
X-Sendfile and VERY big files on Apache2
| 1,693,668 | 1 | 3 | 1,086 | 0 |
python,apache2,wsgi,x-sendfile
|
I have discovered the answer. Use the BETA version provided. It seems to fix this issue.
| 0 | 0 | 0 | 0 |
2009-11-07T16:24:00.000
| 2 | 0.099668 | false | 1,693,564 | 0 | 0 | 1 | 1 |
Any filesize over about 4GB is not going to work with the mod_xsendfile for Apache2 (as it sets the content length to a long).
I am willing to rewrite it to support this; however, I can find no documentation on how to set content length from the apache api to something larger than a long and thus serve large files through Apache. I know Apache can do this as it is compiled with Large File Support and is serving the files through the directory index without any issue.
I need to use Apache as I am using WSGI. I do not want to use FastCGI or switch off Apache2 for various reasons I do not feel like getting into.
Thanks.
|
Move or copy an entity to another kind
| 1,693,856 | 1 | 0 | 162 | 0 |
python,google-app-engine,indexing,archive,bigtable
|
Unless someone's written utilities for this kind of thing, the way to go is to read from one and write to the other kind!
| 0 | 1 | 0 | 0 |
2009-11-07T17:39:00.000
| 2 | 0.099668 | false | 1,693,815 | 0 | 0 | 1 | 2 |
Is there a way to move an entity to another kind in appengine.
Say you have a kind defines, and you want to keep a record of deleted entities of that kind.
But you want to separate the storage of live object and archived objects.
Kinds are basically just serialized dicts in the bigtable anyway. And maybe you don't need to index the archive in the same way as the live data.
So how would you make a move or copy of a entity of one kind to another kind.
|
Move or copy an entity to another kind
| 1,693,979 | 1 | 0 | 162 | 0 |
python,google-app-engine,indexing,archive,bigtable
|
No - once created, the kind is a part of the entity's immutable key. You need to create a new entity and copy everything across. One way to do this would be to use the low-level google.appengine.api.datastore interface, which treats entities as dicts.
| 0 | 1 | 0 | 0 |
2009-11-07T17:39:00.000
| 2 | 1.2 | true | 1,693,815 | 0 | 0 | 1 | 2 |
Is there a way to move an entity to another kind in appengine.
Say you have a kind defines, and you want to keep a record of deleted entities of that kind.
But you want to separate the storage of live object and archived objects.
Kinds are basically just serialized dicts in the bigtable anyway. And maybe you don't need to index the archive in the same way as the live data.
So how would you make a move or copy of a entity of one kind to another kind.
|
Django/SQL: keeping track of who who read what in a forum
| 1,697,224 | 1 | 2 | 354 | 0 |
python,sql,django,database-design,database
|
You might also simply store the last time a user was reading a particular forum. Any posts that have been updated since that date are new. You'll only be storing one additional piece of information per user as opposed to a piece of information per post per user.
| 0 | 0 | 0 | 0 |
2009-11-08T16:24:00.000
| 2 | 1.2 | true | 1,697,045 | 0 | 0 | 1 | 2 |
I'm working on a not-so-big project in django that will among other things incorporate a forum system.
I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts.
The thing is I can't really think of a way to properly store that information. My first idea was to create another model that will store a list of threads with changes in them for each user. Something with one ForeignKey(User) and one ForeignKey(Thread) and just keep adding new entries each time a thread is posted or a post is added to a thread.
But then, I'm not sure how well that would scale with say several hundred threads after a while and maybe 50-200 users. So add 200 rows for each new post for the users who aren't logged on? Sounds like a lot.
How do other forum systems do it anyway? And how can I implement a system to work these things out in Django.
Thanks!
|
Django/SQL: keeping track of who who read what in a forum
| 1,697,061 | 2 | 2 | 354 | 0 |
python,sql,django,database-design,database
|
You're much better off storing the "read" bit, not the "unread" bit. And you can store them not as relational data, but in a giant bit-blob. Then you don't have to modify the read data at all when new posts are added, only when a user reads posts.
| 0 | 0 | 0 | 0 |
2009-11-08T16:24:00.000
| 2 | 0.197375 | false | 1,697,045 | 0 | 0 | 1 | 2 |
I'm working on a not-so-big project in django that will among other things incorporate a forum system.
I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts.
The thing is I can't really think of a way to properly store that information. My first idea was to create another model that will store a list of threads with changes in them for each user. Something with one ForeignKey(User) and one ForeignKey(Thread) and just keep adding new entries each time a thread is posted or a post is added to a thread.
But then, I'm not sure how well that would scale with say several hundred threads after a while and maybe 50-200 users. So add 200 rows for each new post for the users who aren't logged on? Sounds like a lot.
How do other forum systems do it anyway? And how can I implement a system to work these things out in Django.
Thanks!
|
win32com and PAMIE web page open timeout
| 1,698,371 | 0 | 0 | 294 | 0 |
python,time,multithreading,pamie
|
I think what you are looking for is somewhere to set the timeout on your request. I would suggest looking into the documentation on PAMIE.
| 0 | 0 | 1 | 1 |
2009-11-08T23:40:00.000
| 2 | 0 | false | 1,698,362 | 0 | 0 | 1 | 2 |
currently im making some crawler script,one of problem is
sometimes if i open webpage with PAMIE,webpage can't open and hang forever.
are there any method to close PAMIE's IE or win32com's IE ?
such like if webpage didn't response or loading complete less than 10sec or so .
thanks in advance
|
win32com and PAMIE web page open timeout
| 1,698,422 | 2 | 0 | 294 | 0 |
python,time,multithreading,pamie
|
Just use, to initialize your PAMIE instance, PAMIE(timeOut=100) or whatever. The units of measure for timeOut are "tenths of a second" (!); the default is 3000 (300 seconds, i.e., 5 minutes); with 300 as I suggested, you'd time out after 10 seconds as you request.
(You can pass the timeOut= parameter even when you're initializing with a URL, but in that case the timeout will only be active after the initial navigation).
| 0 | 0 | 1 | 1 |
2009-11-08T23:40:00.000
| 2 | 1.2 | true | 1,698,362 | 0 | 0 | 1 | 2 |
currently im making some crawler script,one of problem is
sometimes if i open webpage with PAMIE,webpage can't open and hang forever.
are there any method to close PAMIE's IE or win32com's IE ?
such like if webpage didn't response or loading complete less than 10sec or so .
thanks in advance
|
Environment on google Appengine
| 1,701,239 | 3 | 0 | 461 | 0 |
python,google-app-engine
|
To answer the actual question from the title of your post, assuming you're still wondering: to get environment variables, simple import os and the environment is available in os.environ.
| 0 | 1 | 0 | 0 |
2009-11-09T11:24:00.000
| 3 | 0.197375 | false | 1,700,441 | 0 | 0 | 1 | 1 |
does someone have an idea how to get the environment variables on Google-AppEngine ?
I'm trying to write a simple Script that shall use the Client-IP (for Authentication) and a parameter (geturl or so) from the URL (for e.g. http://thingy.appspot.dom/index?geturl=www.google.at)
I red that i should be able to get the Client-IP via "request.remote_addr" but i seem to lack 'request' even tho i imported webapp from google.appengine.ext
Many thanks in advance,
Birt
|
Is there an analogue to Java IllegalStateException in Python?
| 1,701,327 | 43 | 67 | 12,359 | 0 |
java,python,exception
|
In Python, that would be ValueError, or a subclass of it.
For example, trying to .read() a closed file raises "ValueError: I/O operation on closed file".
| 0 | 0 | 0 | 0 |
2009-11-09T14:12:00.000
| 3 | 1.2 | true | 1,701,199 | 1 | 0 | 1 | 1 |
IllegalStateException is often used in Java when a method is invoked on an object in inappropriate state. What would you use instead in Python?
|
How can I make WSGI(Python) stateful?
| 1,718,144 | 2 | 1 | 1,364 | 0 |
python,wsgi
|
I prefer working directly on wsgi, along with mako and psycopg.
It's good to know about Beaker, though I usually don't hold state in the server because I believe it reduces scalability. I either put it in the user's cookie, in the database tied to a token in the user's cookie, or in a redirect url.
| 0 | 0 | 0 | 0 |
2009-11-09T20:11:00.000
| 3 | 0.132549 | false | 1,703,440 | 0 | 0 | 1 | 3 |
I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request.
Is it also possible in python using WSGI?
Or stateful and stateless are handled in other layer?
|
How can I make WSGI(Python) stateful?
| 1,703,477 | 1 | 1 | 1,364 | 0 |
python,wsgi
|
Your question is a little vague and open-ended. First of all, WSGI itself isn't a framework, it's just the glue to connect a framework to the web server. Secondly, I'm not clear on what you mean when you say "state" -- do you mean storing information about a client on the server? If so, web frameworks (Pylons, Django, etc) allow you to store that kind of information in web session variables.
| 0 | 0 | 0 | 0 |
2009-11-09T20:11:00.000
| 3 | 0.066568 | false | 1,703,440 | 0 | 0 | 1 | 3 |
I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request.
Is it also possible in python using WSGI?
Or stateful and stateless are handled in other layer?
|
How can I make WSGI(Python) stateful?
| 1,703,470 | 5 | 1 | 1,364 | 0 |
python,wsgi
|
Usually, you don't work with "bare" WSGI. You work with web-frameworks, such as Pylons or TurboGears2.
And these contain a session-middleware, based on WSGI - called "Beaker". But if you work with the framework, you don't have to worry about that - you just use it.
But if you insist, you can of course use Beaker standalone.
| 0 | 0 | 0 | 0 |
2009-11-09T20:11:00.000
| 3 | 0.321513 | false | 1,703,440 | 0 | 0 | 1 | 3 |
I'm quite new in Python world. I come from java and ABAP world, where their application server are able to handle stateful request.
Is it also possible in python using WSGI?
Or stateful and stateless are handled in other layer?
|
Python Form Processing alternatives
| 1,705,231 | 1 | 3 | 1,382 | 0 |
python,google-app-engine,forms
|
Is there a more specific reason you don't want to use django.forms? I've quite successfully used bits and pieces of django all by themselves without trouble in several projects.
As an aside, there are several patches that make django sortof work in app-engine, though I assume you've considered and discarded them.
| 0 | 0 | 0 | 0 |
2009-11-10T02:02:00.000
| 4 | 0.049958 | false | 1,705,217 | 0 | 0 | 1 | 1 |
django.forms is very nice, and does almost exactly what I want to do on my current project, but unfortunately, Google App Engine makes most of the rest of Django unusable, and so packing it along with the app seems kind of silly.
I've also discovered FormAlchemy, which is an SQLAlchemy analog to Django forms, and I intend to explore that fully, but it's relationship with SQLAlchemy suggests that it may also give me some trouble.
Is there any HTML Forms processing library for python that I haven't considered?
|
Understanding Zope internals, from Django eyes
| 1,707,165 | 3 | 8 | 3,052 | 0 |
python,django,zope,zodb,acquisition
|
ZODB is a OO-style database that doesn't need a schema definition. You can simply create (nearly) all kinds of objects, and persist them.
The TTW is sometimes annoying, but you can mount the ZOPE-object-tree using webdav. Then you can edit the templates and scripts using your favorite editor.
ZOPE is especially powerful for creating CMS-like systems, IMHO there it is still unmatched - you'd have to go through a lot to make it work equally well in Django.
And through the TTW, actually non-developers like designers have a good chance of developing e.g. templates and CSS without need for developer interaction.
| 0 | 0 | 0 | 0 |
2009-11-10T08:05:00.000
| 6 | 0.099668 | false | 1,706,309 | 0 | 0 | 1 | 1 |
I am a newbie to zope and I previously worked on Django for about 2.5 years. So when I first jumped into Zope(v2) (only because my new company is using it since 7 years), I faced these questions. Please help me in understanding them.
What is the "real" purpose of zodb as such? I know what it does, but tell me one great thing that zodb does and a framework like Django (which doesn't have zodb) misses.
Update: Based on the answers, Zodb replaces the need for ORM. You can directly store the object inside the db(zodb itself).
It is said one of the zope's killer feature is the TTW(Through the Web or Developing using ZMI) philosophy. But I(and any developer) prefers File-System based development(using Version control, using Eclipse, using any favorite tool outside Zope). Then where is this TTW actually used?
This is the big one. What "EXTRA Stuff" does Zope's Acquistion gain when compared to Python/Django Inheritance.
Is it really a good move to come to Zope, from Django ?
Any site like djangosnippets.org for Zope(v2)?
|
IronPython asp.net IntelliSense
| 1,728,528 | 0 | 1 | 198 | 0 |
asp.net,visual-studio,visual-studio-2008,ironpython
|
I had to uninstall IronPython and install ASP.NET future releases to solve it
| 0 | 0 | 0 | 0 |
2009-11-10T11:46:00.000
| 2 | 0 | false | 1,707,390 | 1 | 0 | 1 | 1 |
I'm trying IronPython for asp.net, I got a simple CRUD screen to work. I've read IntelliSense doesnt work for IronPython, but is there any way to get rid of Visual Studio underlining all the lines' starting tokens with blue and a message of "expected declaration"?
|
getting started with django-cms: error on page_submit_row
| 1,709,285 | 0 | 1 | 462 | 0 |
python,django,django-cms
|
You may need to {% load %} the template tag library at the top of your file.
| 0 | 0 | 0 | 0 |
2009-11-10T16:22:00.000
| 2 | 0 | false | 1,709,201 | 0 | 0 | 1 | 2 |
I am getting started with django-cms and I am facing an exception when I try to edit a page in the admin inteface.
A TemplateSyntaxError exception is raised due to the {% page_submit_row %} templatetag.
TemplateSyntaxError at /admin/cms/page/1/
Caught an exception while rendering: admin/page_submit_line.html
Request Method: GET
Request URL: http://127.0.0.1:8082/admin/cms/page/1/
Exception Type: TemplateSyntaxError
Exception Value: Caught an exception while rendering: admin/page_submit_line.html
Exception Location: C:\Program Files\Python26\lib\site-packages\django\template\debug.py in render_node, line 81
Does anybody know also a good tutorial of django-cms?
Update: It seems that the installation of django-cms is not fully sucessful. The admin/page_submit_line.html template was missing. I've try to reinstall several time with similar result. A manual copy of the file fix the problem.
How can I be sure that the install has be done properly? I guess that some other files are missing. Is it safe to copy the missing files manually?
|
getting started with django-cms: error on page_submit_row
| 1,709,611 | 0 | 1 | 462 | 0 |
python,django,django-cms
|
It seems that the problem comes from the django-cms installer. It was with RC2 and RC3 is out now.
Moreover, It is recommended to use easy_install for the installation
easy_instaling RC3 fixed the problem
Best
| 0 | 0 | 0 | 0 |
2009-11-10T16:22:00.000
| 2 | 1.2 | true | 1,709,201 | 0 | 0 | 1 | 2 |
I am getting started with django-cms and I am facing an exception when I try to edit a page in the admin inteface.
A TemplateSyntaxError exception is raised due to the {% page_submit_row %} templatetag.
TemplateSyntaxError at /admin/cms/page/1/
Caught an exception while rendering: admin/page_submit_line.html
Request Method: GET
Request URL: http://127.0.0.1:8082/admin/cms/page/1/
Exception Type: TemplateSyntaxError
Exception Value: Caught an exception while rendering: admin/page_submit_line.html
Exception Location: C:\Program Files\Python26\lib\site-packages\django\template\debug.py in render_node, line 81
Does anybody know also a good tutorial of django-cms?
Update: It seems that the installation of django-cms is not fully sucessful. The admin/page_submit_line.html template was missing. I've try to reinstall several time with similar result. A manual copy of the file fix the problem.
How can I be sure that the install has be done properly? I guess that some other files are missing. Is it safe to copy the missing files manually?
|
What Jabber/XMPP libraries are available for PyS60 (Python for Symbian S60) interpreter?
| 1,716,884 | 0 | 2 | 912 | 0 |
python,symbian,xmpp,pys60
|
It's fairly easy to add native extensions to Python and there are lots of C/C++ libraries for XMPP that would port easily.
The previous pyexpat module is just bindings for native expat on Symbian, which is ported to S60 3rd Edition, so you should be able to get pyexpat working too. Of course you need some ability with native development to do that...
You could try getting started and then ask for help in developer.symbian.org if you get stuck.
| 0 | 0 | 0 | 0 |
2009-11-11T03:11:00.000
| 1 | 1.2 | true | 1,712,768 | 0 | 0 | 1 | 1 |
I'm interested in developing a XMPP client on the mobile S60 Symbian platform using the Python interpreter PyS60. I've done a search on Google for possible libraries, but turned up empty.
I'm hoping that by asking this on SO, I can get a definite answer on whether there is actually an existing library that I just hadn't had the luck to find, or if it doesn't really exist. Failing that, I'm thinking of writing my own library. If there is any XML library within PyS60 to make this task easier (I know the normal interpreter has libraries, but they don't appear to be portable to PyS60), that would be good.
The target device is a Nokia N78, Symbian 3rd Edition FP (Feature Pack) 2
|
Pylons deployment questions
| 1,712,913 | 2 | 0 | 450 | 0 |
python,apache,deployment,apache2,pylons
|
mod_wsgi. It's more efficient. FastCGI can be troublesome to setup, whereas I've never known anyone to have a problem using mod_wsgi with a supported version of Python (2.5, 2.6, 3.1 included). WSGI exists for Python (by Python, &c.) and so it makes for a more "Pythonic" experience. Prior to WSGI I used to serve small Pylons apps via paste behind mod_proxy (due to massive issues with fastcgi).
Anywhere is fine, any user is fine. If you're worried about security, you may wish to add another user. You could create a home folder in /www/ if you were so inclined :) Static binary files, images, etc., should be served separately if you can, but Pylons had (actually, I believe still does have) a method of serving these (this should be the 'public' folder). I would still use a separate mount as Apache is more efficient at serving these than passing them through Pylons.
| 0 | 0 | 0 | 1 |
2009-11-11T03:50:00.000
| 1 | 1.2 | true | 1,712,883 | 0 | 0 | 1 | 1 |
I'm a beginner with Pylons and I've mostly developed on my localhost using the built-in web server. I think it's time to start deployment for my personal blog, I have a Debian Lenny server with apache2-mpm-prefork module and mod_wsgi - I've never really used mod_wsgi or fastcgi and I hear either of these are the way to go.
My questions:
Should I go with mod_wsgi or fastcgi and why?
Where should I be creating my web application? Should I create an entirely new user for it? Should I store it in /home/meder/web-app ? I currently have some php websites being hosted on my server and they live in /www/ which is a directory I created. Is there any sorta gotcha with static binary files such as images, as there is with django?
|
Is there any library to deserialize with python which is serialized with java
| 1,714,644 | 6 | 13 | 8,371 | 0 |
java,python,serialization
|
Java binary serialization is really designed to be used with Java. To do it in Python you'd have to have all the relevant Java classes available for inspection, and create Python objects appropriately - it would be pretty hideous and fragile.
You're better off using a cross-platform serialization format such as Thrift, Protocol Buffers, JSON or XML. If you can't change which serialization format is used in the Java code, I'd suggest writing new Java code which deserializes from the binary format and then reserializes to a cross-platform format.
| 0 | 0 | 1 | 0 |
2009-11-11T11:33:00.000
| 7 | 1 | false | 1,714,624 | 0 | 0 | 1 | 2 |
Is there any library to deserialize with python which is serialized with java?
|
Is there any library to deserialize with python which is serialized with java
| 1,714,862 | 0 | 13 | 8,371 | 0 |
java,python,serialization
|
If you are using Java classes, then I don't even know what it would mean to deserialize a Java class in a Python environment. If you are only using simple primitives (ints, floats, strings), then it probably wouldn't be too hard to build a Python library that could deserialize the Java format.
But as others have said, there are better cross-platform solutions.
| 0 | 0 | 1 | 0 |
2009-11-11T11:33:00.000
| 7 | 0 | false | 1,714,624 | 0 | 0 | 1 | 2 |
Is there any library to deserialize with python which is serialized with java?
|
Django Form Wizard and Preview with ModelForm
| 2,152,059 | 1 | 9 | 2,727 | 0 |
python,django,forms,wizard,preview
|
I do a similar thing at my first Django project. Using session-based FormWizard, I customized it so user can stop subbmiting data at any form.
At that point you can use FormPreview probably to show information or just dynamically generate form and show it to user. Data stays in the session.
| 0 | 0 | 0 | 0 |
2009-11-11T16:15:00.000
| 2 | 0.099668 | false | 1,716,247 | 0 | 0 | 1 | 1 |
I have a large Django model (73 fields) that will will be connected to a ModelForm. I'd like to use a combination of the functionality found the Form Wizard and Form Preview contrib apps.
I.e., the form fields would be split over multiple pages, and the user would have a chance to review/preview the data before the model instance is created.
Are there any best-practices for this type of thing, or example code?
|
"CSRF verification failed" when attempting to upload a file or create a folder with filebrowser for Django
| 1,718,362 | 6 | 10 | 16,007 | 0 |
python,django,upload,file-upload
|
You are probably using the development version of Django, which includes quite a lot of extra CRSF security. However it's not released yet so external products probably aren't compatible. You should use the 1.1 version of Django instead.
| 0 | 0 | 0 | 0 |
2009-11-11T21:56:00.000
| 5 | 1.2 | true | 1,718,343 | 0 | 0 | 1 | 2 |
I have installed filebrowser for Django (not filebrowser3) and when I try to upload a file I recieve the following error:
403 Forbidden
CSRF verification failed. Request
aborted.
More information is available with
DEBUG=True.
The same error occurs when I try to create a new folder which shows that the problem is that filebrowser cannot create files/direcories within my uploads directory. I am using the default settings and have manually created the /media/uploads directory with it's permissions set as 755.
If I upload a file to the directory then file-browser admin page states:
1 Item Folder: 0 Image: 1
I cannot view the image that I have uploaded.
I have the PIL and sorl.thumbnail modules installed.
|
"CSRF verification failed" when attempting to upload a file or create a folder with filebrowser for Django
| 4,137,086 | 4 | 10 | 16,007 | 0 |
python,django,upload,file-upload
|
Add to you settings.py this 2 lines:
‘django.middleware.csrf.CsrfViewMiddleware’,
‘django.middleware.csrf.CsrfResponseMiddleware’,
| 0 | 0 | 0 | 0 |
2009-11-11T21:56:00.000
| 5 | 0.158649 | false | 1,718,343 | 0 | 0 | 1 | 2 |
I have installed filebrowser for Django (not filebrowser3) and when I try to upload a file I recieve the following error:
403 Forbidden
CSRF verification failed. Request
aborted.
More information is available with
DEBUG=True.
The same error occurs when I try to create a new folder which shows that the problem is that filebrowser cannot create files/direcories within my uploads directory. I am using the default settings and have manually created the /media/uploads directory with it's permissions set as 755.
If I upload a file to the directory then file-browser admin page states:
1 Item Folder: 0 Image: 1
I cannot view the image that I have uploaded.
I have the PIL and sorl.thumbnail modules installed.
|
Render page initially and update via AJAX using the same template HTML
| 1,718,808 | 3 | 10 | 2,693 | 0 |
javascript,python,ajax,django
|
I think option 2 is best. It's incremental (only renders one more comment when a comment is added), and re-uses the rendering. If you don't like returning just HTML from an Ajax request, then have the response be a JSON structure which includes the HTML as just one component. Then you can also carry status (or whatever) without an extra request to get the HTML.
Option 1 is wasteful: the server should render the page as it should first appear.
Option 3 is also wasteful: why make two requests to add a single comment?
| 0 | 0 | 0 | 0 |
2009-11-11T23:18:00.000
| 3 | 1.2 | true | 1,718,784 | 0 | 0 | 1 | 2 |
Let's say you have a view called "View Story" which is just a web page rendered on the backend via Python/Django. On that page there's a list of comments at the bottom rendered as part of the "View Story" template using Django's templating system (in a loop). This page also allows you to add a comment to the list. This is done through AJAX and the page is updated with the new comment (without sending a new full page request).
Now, when adding the new comment to the end of the list I want the HTML that's generated for this new comment (something inside an <li>) to use the exact same code that was used to generate the original comments sent to the client via the original request.
There's multiple ways to do this:
Have the initial rendering throw the comment data into a javascript variable and once the page is rendered add the content via javascript. Then when new comments are added that same javascript can be used to render the new one. The problem: from a search engine perspective I'm not sure google would be able to index the comments if they're generated after the page has been rendered - I'm guessing not
Each time a new comment is added via AJAX, have the ajax request return the actual HTML to put on the page rather than just the JSON data of the new comment. The HTML can be generated using the same template snippet that was used to render the original page. The problem with this is that it ties that AJAX request to a particular view or a way of rendering it which I don't like.
Similar to #2 except that a separate request is made to retrieve the HTML for the new comment or maybe all the comments and the list is just wiped and re-rendered. Don't like that cause it's deeply inefficient and unnecessarily time-consuming.
So, to summarize, I want a way to avoid duplicating Template/HTML code for a single view. And I would like some advice on what has worked for others because I'm pretty sure this is a common case irregardless of the technology on the back-end.
Thanks!
|
Render page initially and update via AJAX using the same template HTML
| 3,067,371 | 1 | 10 | 2,693 | 0 |
javascript,python,ajax,django
|
There is also option 4:
Copy an existing element in the list and change its values. This is of course less flexible than templates. You can copy a hidden element instead to handle the case where the list is empty.
You could also try option 2b:
Generate the HTML on the server like option 2, but instead of directly accessing the database, pass the generation routine the JSON (or an object that can easily be converted to JSON). This involves more work, but means that you are effectively writing an API at the same time you are writing your own website.
Option 1 is what any non-web application would use. Even though search engines are improving in their ability to handle AJAX, it is still strongly recommended to return all the content in HTML. I think Javascript is fast enough in all modern browsers that except for huge pages 1 would be quite reasonable except for the SEO issue.
There is also option 5 - use Javascript on the server to generate the page and use the same code on the client. This is probably the most complicated approach and I wouldn't recommend it unless you really have a good reason.
| 0 | 0 | 0 | 0 |
2009-11-11T23:18:00.000
| 3 | 0.066568 | false | 1,718,784 | 0 | 0 | 1 | 2 |
Let's say you have a view called "View Story" which is just a web page rendered on the backend via Python/Django. On that page there's a list of comments at the bottom rendered as part of the "View Story" template using Django's templating system (in a loop). This page also allows you to add a comment to the list. This is done through AJAX and the page is updated with the new comment (without sending a new full page request).
Now, when adding the new comment to the end of the list I want the HTML that's generated for this new comment (something inside an <li>) to use the exact same code that was used to generate the original comments sent to the client via the original request.
There's multiple ways to do this:
Have the initial rendering throw the comment data into a javascript variable and once the page is rendered add the content via javascript. Then when new comments are added that same javascript can be used to render the new one. The problem: from a search engine perspective I'm not sure google would be able to index the comments if they're generated after the page has been rendered - I'm guessing not
Each time a new comment is added via AJAX, have the ajax request return the actual HTML to put on the page rather than just the JSON data of the new comment. The HTML can be generated using the same template snippet that was used to render the original page. The problem with this is that it ties that AJAX request to a particular view or a way of rendering it which I don't like.
Similar to #2 except that a separate request is made to retrieve the HTML for the new comment or maybe all the comments and the list is just wiped and re-rendered. Don't like that cause it's deeply inefficient and unnecessarily time-consuming.
So, to summarize, I want a way to avoid duplicating Template/HTML code for a single view. And I would like some advice on what has worked for others because I'm pretty sure this is a common case irregardless of the technology on the back-end.
Thanks!
|
Python website convert into Adobe Dreamweaver CS3
| 1,719,141 | 1 | 0 | 458 | 0 |
python,dreamweaver
|
Assuming that any functionality needs to remain intact… no.
| 0 | 0 | 0 | 0 |
2009-11-12T00:44:00.000
| 3 | 0.066568 | false | 1,719,127 | 1 | 0 | 1 | 3 |
I am comfortable in Adobe Dreamweaver CS3. Is there a way to convert a website written in the Python language into Dreamweaver for those who aren't familiar with writing in code?
|
Python website convert into Adobe Dreamweaver CS3
| 1,719,178 | 0 | 0 | 458 | 0 |
python,dreamweaver
|
Well, you can simply copy the HTML that Python generates to make a static copy of the website, but you'll lose any interactivity. In other words, you won't be able to use the website's administrative panel to modify anything. It will let you modify the style of the website, however.
| 0 | 0 | 0 | 0 |
2009-11-12T00:44:00.000
| 3 | 0 | false | 1,719,127 | 1 | 0 | 1 | 3 |
I am comfortable in Adobe Dreamweaver CS3. Is there a way to convert a website written in the Python language into Dreamweaver for those who aren't familiar with writing in code?
|
Python website convert into Adobe Dreamweaver CS3
| 1,719,759 | 1 | 0 | 458 | 0 |
python,dreamweaver
|
If you mean a tool which can convert a python site into dreamweaver, not possible yet, such intelligent machines are not yet invented, but evolution has produced you,
so what you can do is see the site page by page, and make it again in dreamweaver. If you have specs and designs of python site handy that would speed up the things. offcourse you can easily copy css etc, you can use tools like firbug/chrome inspector to see how css is being used.
| 0 | 0 | 0 | 0 |
2009-11-12T00:44:00.000
| 3 | 0.066568 | false | 1,719,127 | 1 | 0 | 1 | 3 |
I am comfortable in Adobe Dreamweaver CS3. Is there a way to convert a website written in the Python language into Dreamweaver for those who aren't familiar with writing in code?
|
Remove "add another" in Django admin screen
| 51,260,433 | 1 | 35 | 24,607 | 0 |
python,django,django-admin
|
I'm using Django 2.x and I think I found best solution, at least for my case.
The HTML file to the "Save and Add Another" button is on your_python_installation\Lib\site-packages\django\contrib\admin\templates\admin\subtmit_line.html.
Copy that html file and paste to your project like so your_project\templates\admin\submit_line.html.
Open it and comment/delete the button code as desired:
{#{% if show_save_and_add_another %}<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother" />{% endif %}#}
I know this problem is already answered. But maybe someone in the future have a similar case with me.
| 0 | 0 | 0 | 0 |
2009-11-12T09:35:00.000
| 12 | 0.016665 | false | 1,721,037 | 0 | 0 | 1 | 1 |
Whenever I'm editing object A with a foreign key to object B, a plus option "add another" is available next to the choices of object B. How do I remove that option?
I configured a user without rights to add object B. The plus sign is still available, but when I click on it, it says "Permission denied". It's ugly.
I'm using Django 1.0.2
|
VB webform in IronPython asp.net website
| 1,747,832 | 1 | 0 | 312 | 0 |
asp.net,vb.net,ironpython
|
The code between <script /> tags is compiled dynamically when the page is first run. This enables you to mix languages. However, the classes in your code-behind files are statically compiled into an assembly by VS.NET ... and a VS.NET project can only support one language at a time.
One solution is to put your VB.NET code-behinds in a separate assembly. For example:
Add a new VB Class Library project to your existing solution
Add a reference to System.Web
Create your VB.NET code-behinds. They should be normal classes inheriting from System.Web.UI.Page.
In your ASP.NET website project, add a reference to the new project
Edit the @ Page directives in your *.aspx files to inherit the classes in the new project
e.g. <%@ Page Inherits="YourNewVBClassLibraryProject.MyVBCodeBehinds" ... /> where the Inherits attribute contains the relevant namespace-qualified class name
| 0 | 0 | 0 | 0 |
2009-11-12T12:09:00.000
| 2 | 1.2 | true | 1,721,761 | 1 | 0 | 1 | 1 |
I tried to bring a previously done webform made in vb.net to an IronPython asp.net website with no luck. After seeing it didnt work, I tried to write the simplest codebehind vb.net webform to see if there was a problem with vb.net in an IronPython website and I got the following usual error
"be sure that the defined class in this file matchs with the one in the attribute inherits and that it extends the right base page (page or control)" (sorry if the translation isnt the most accurate I get that message in spanish)
but if I create a vb.net webform in the same website, with the sourcecode in the same file (with the vb.net code between script runat="server" tags in the same page) I get no problem.
Do I have to configure something for both kind of sourcecode languages to run in such way in the same IronPython website, like configuring something in the webconfig file or is there some compatibility issue for doing that which can't be resolved?
|
How to create a UserProfile form in Django with first_name, last_name modifications?
| 1,876,244 | 0 | 25 | 25,783 | 0 |
python,django,profile,django-forms
|
Why not have two model forms on the back-end and just present them as a single form in your template? Drop the name fields from your UserProfileForm and create a second model form for the user object?
| 0 | 0 | 0 | 0 |
2009-11-13T06:46:00.000
| 7 | 0 | false | 1,727,564 | 0 | 0 | 1 | 2 |
If think my question is pretty obvious and almost every developer working with UserProfile should be able to answer it.
However, I could not find any help on the django documentation or in the Django Book.
When you want to do a UserProfile form in with Django Forms, you'd like to modify the profile fields as well as some User field.
But there is no forms.UserProfileForm (yet?)!
How do you do that?
|
How to create a UserProfile form in Django with first_name, last_name modifications?
| 1,727,895 | 0 | 25 | 25,783 | 0 |
python,django,profile,django-forms
|
I take it normal that you don't find any information in the docs as you merge two models into a single form.
Alternatively and maybe very obviously you can: Create two modelforms, one for the user and the other for the userprofile. Set the userprofile modelform to display only firstname and lastname. Put both forms in the same template within a single <form> tag. When it is submitted, call the save methods of each form.
| 0 | 0 | 0 | 0 |
2009-11-13T06:46:00.000
| 7 | 0 | false | 1,727,564 | 0 | 0 | 1 | 2 |
If think my question is pretty obvious and almost every developer working with UserProfile should be able to answer it.
However, I could not find any help on the django documentation or in the Django Book.
When you want to do a UserProfile form in with Django Forms, you'd like to modify the profile fields as well as some User field.
But there is no forms.UserProfileForm (yet?)!
How do you do that?
|
Django ease of building a RESTful interface
| 1,791,400 | 2 | 10 | 6,277 | 0 |
python,django,rest
|
Regarding your comment about not liking 3rd party code - that's too bad because the pluggable apps are one of django's greatest features. Like others answered, piston will do most of the work for you.
| 0 | 0 | 0 | 0 |
2009-11-13T23:03:00.000
| 6 | 0.066568 | false | 1,732,452 | 0 | 0 | 1 | 2 |
I'm looking for an excuse to learn Django for a new project that has come up. Typically I like to build RESTful server-side interfaces where a URL maps to resources that spits out data in some platform independent context, such as XML or JSON. This is
rather straightforward to do without the use of frameworks, but some of them such as Ruby on Rails conveniently allow you to easily spit back XML to a client based on the type of URL you pass it, based on your existing model code.
My question is, does something like Django have support for this? I've googled and found some 'RESTful' 3rd party code that can go on top of Django. Not sure if I'm too keen on that.
If not Django, any other Python framework that's already built with this in mind so I do not have to reinvent the wheel as I already have in languages like PHP?
|
Django ease of building a RESTful interface
| 1,732,636 | 1 | 10 | 6,277 | 0 |
python,django,rest
|
A little over a year ago, I wrote a REST web service in Django for a large Seattle company that does streaming media on the Internet.
Django was excellent for the purpose. As "a paid nerd" observed, the Django URL config is wonderful: you can set up your URLs just the way you want them, and have it serve up the appropriate objects.
The one thing I didn't like: the Django ORM has absolutely no support for binary BLOBs. If you want to serve up photos or something, you will need to keep them in a file system, and not in a database. Because we were using multiple servers, I had to choose between writing my own BLOB support or finding some replication framework that would keep all the servers up to date with the latest binary data. (I chose to write my own BLOB support. It wasn't very hard, so I was actually annoyed that the Django guys didn't do that work. There should be one, and preferably only one, obvious way to do something.)
I really like the Django ORM. It makes the database part really easy; you don't need to know any SQL. (I don't like SQL and I do like Python, so it's a double win.) The "admin interface", which you get for free, gives you a great way to look through your data, and to poke data in during testing and development.
I recommend Django without reservation.
| 0 | 0 | 0 | 0 |
2009-11-13T23:03:00.000
| 6 | 0.033321 | false | 1,732,452 | 0 | 0 | 1 | 2 |
I'm looking for an excuse to learn Django for a new project that has come up. Typically I like to build RESTful server-side interfaces where a URL maps to resources that spits out data in some platform independent context, such as XML or JSON. This is
rather straightforward to do without the use of frameworks, but some of them such as Ruby on Rails conveniently allow you to easily spit back XML to a client based on the type of URL you pass it, based on your existing model code.
My question is, does something like Django have support for this? I've googled and found some 'RESTful' 3rd party code that can go on top of Django. Not sure if I'm too keen on that.
If not Django, any other Python framework that's already built with this in mind so I do not have to reinvent the wheel as I already have in languages like PHP?
|
2 mysql instances in MAC
| 1,734,939 | 1 | 0 | 150 | 1 |
python,mysql,django,macos,xampp
|
You could change the listening port of one of the installations and they shouldn't conflict anymore with each other.
Update: You need to find the mysql configuration file my.cnf of the server which should get a new port (the one from xampp should be somewhere in the xampp folder). Find the line port=3306 in the [mysqld] section. You could change it to something like 3307.
You will also need to specify the new port when connecting to the server from your applications.
| 0 | 0 | 0 | 0 |
2009-11-14T17:22:00.000
| 1 | 1.2 | true | 1,734,918 | 0 | 0 | 1 | 1 |
i recently switched to mac. first and foremost i installed xampp.
then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL.
now the seperate mysql installation is active all the time and the Xampp one doesnt switch on unless i kill the other one.
what i wanted to know is it possible to make xampp work with the seperate mysql installation? because that way i wouldnt have to tinker around with the mysqlDB adapter for python?
any help would be appreciated.
|
Compress data before storage on Google App Engine
| 2,125,539 | 0 | 1 | 2,545 | 0 |
python,google-app-engine,compression,gzip,zlib
|
You can store up to 10Mb with a list of Blobs. Search for google file service.
It's much more versatile than BlobStore in my opinion, since I just started using BlobStore Api yesterday and I'm still figuring out if it is possible to access the data bytewise.. as in changing doc to pdf, jpeg to gif..
You can storage Blobs of 1Mb * 10 = 10 Mb (max entity size I think), or you can use BlobStore API and get the same 10Mb or get 50Mb if you enable billing (you can enable it but if you don't pass the free quota you don't pay).
| 0 | 1 | 0 | 0 |
2009-11-16T00:55:00.000
| 5 | 0 | false | 1,739,543 | 0 | 0 | 1 | 2 |
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest I accomplish this (It can happen in the background by the way via a task queue but an efficient solution is always good)
Based on my own tests and research - I see two possible approaches to accomplish this
Zlib
For this I need to compress a certain number of blocks at a time using a While loop. However, App Engine doesnt allow you to write to the file system. I thought about using a Temporary File to accomplish this but I havent had luck with this approach when trying to decompress the content from a Temporary File
Gzip
From reading around the web, it appears that the app engine url fetch function requests content gzipped already and then decompresses it. Is there a way to stop the function from decompressing the content so that I can just put it in the datastore in gzipped format and then decompress it when I need to play it back to a user on demand?
Let me know how you would suggest using zlib or gzip or some other solution to accmoplish this. Thanks
|
Compress data before storage on Google App Engine
| 1,739,598 | 2 | 1 | 2,545 | 0 |
python,google-app-engine,compression,gzip,zlib
|
"Compressing before upload" implies doing it in the user's browser -- but no text in your question addresses that! It seems to be about compression in your GAE app, where of course the data will only be after the upload. You could do it with a Firefox extension (or other browsers' equivalents), if you can develop those and convince your users to install them, but that has nothing much to do with GAE!-) Not to mention that, as @RageZ's comment mentions, MP3 is, essentially, already compressed, so there's little or nothing to gain (though maybe you could, again with a browser extension for the user, reduce the MP3's bit rate and thus the file's dimension, that could impact the audio quality, depending on your intended use for those audio files).
So, overall, I have to second @jldupont's suggestion (also in a comment) -- use a different server for storage of large files (S3, Amazon's offering, is surely a possibility though not the only one).
| 0 | 1 | 0 | 0 |
2009-11-16T00:55:00.000
| 5 | 1.2 | true | 1,739,543 | 0 | 0 | 1 | 2 |
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest I accomplish this (It can happen in the background by the way via a task queue but an efficient solution is always good)
Based on my own tests and research - I see two possible approaches to accomplish this
Zlib
For this I need to compress a certain number of blocks at a time using a While loop. However, App Engine doesnt allow you to write to the file system. I thought about using a Temporary File to accomplish this but I havent had luck with this approach when trying to decompress the content from a Temporary File
Gzip
From reading around the web, it appears that the app engine url fetch function requests content gzipped already and then decompresses it. Is there a way to stop the function from decompressing the content so that I can just put it in the datastore in gzipped format and then decompress it when I need to play it back to a user on demand?
Let me know how you would suggest using zlib or gzip or some other solution to accmoplish this. Thanks
|
Is there a speed difference between WSGI and FCGI?
| 1,747,336 | 27 | 39 | 25,057 | 0 |
python,wsgi,fastcgi
|
They are two different things. WSGI is a Python specific interface for writing web applications. There are wrappers for about any web server protocol to provide the WSGI interface. FastCGI (FCGI) is one of such web server protocols. So, WSGI is an abstraction layer, while CGI / FastCGI / mod_python are how the actual web servers talk to the application. Some code has to translate the native interface to WSGI (there is a CGI module in wsgiref, there is flup for FastCGI, etc.). There is also mod_wsgi for Apache, which does the translation directly in an Apache module, so you don't need any Python wrapper.
| 1 | 0 | 0 | 1 |
2009-11-17T07:59:00.000
| 2 | 1 | false | 1,747,266 | 0 | 0 | 1 | 2 |
From the web I've gleaned that WSGI is a CGI for python web development/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference between the two in reference to the languages python and C/++.
|
Is there a speed difference between WSGI and FCGI?
| 1,748,161 | 80 | 39 | 25,057 | 0 |
python,wsgi,fastcgi
|
Correct, WSGI is a Python programmatic API definition and FASTCGI is a language agnostic socket wire protocol definition. Effectively they are at different layers with WSGI being a higher layer. In other words, one can implement WSGI on top of something that so happened to use FASTCGI to communicate with a web server, but not the other way around.
In general, FASTCGI being a socket wire protocol means that you always need some type of programmatic interface on top to use it. For Python one such option is WSGI. As FASTCGI is just a means to an end, one can't really compare its performance to WSGI in that case because WSGI isn't a comparable socket wire protocol, but a user of FASTCGI itself.
One could try and compare performance of different language interfaces on top of FASTCGI, but in general that is quite meaningless in itself as the lower network layer and server request handling aren't the bottleneck. Instead your application code and database will be.
| 1 | 0 | 0 | 1 |
2009-11-17T07:59:00.000
| 2 | 1.2 | true | 1,747,266 | 0 | 0 | 1 | 2 |
From the web I've gleaned that WSGI is a CGI for python web development/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference between the two in reference to the languages python and C/++.
|
Getting data from an Excel sheet
| 11,293,612 | -1 | 3 | 7,027 | 1 |
python,django,excel,postgresql
|
Just started using XLRD and it looks very easy and simple to use.
Beware that it does not support Excel 2007 yet, so keep in mind to save your excel at 2003 format.
| 0 | 0 | 0 | 0 |
2009-11-17T09:07:00.000
| 9 | -0.022219 | false | 1,747,501 | 0 | 0 | 1 | 1 |
How do I load data from an Excel sheet into my Django application? I'm using database PosgreSQL as the database.
I want to do this programmatically. A client wants to load two different lists onto the website weekly and they don't want to do it in the admin section, they just want the lists loaded from an Excel sheet. Please help because I'm kind of new here.
|
Integration Testing for a Web App
| 1,747,828 | 1 | 10 | 5,279 | 0 |
python,ruby,perl,automated-tests,integration-testing
|
I would also recommend Selenium. It got a really nice Firefox Plugin, that you can use to create your integration tests.
| 0 | 0 | 0 | 1 |
2009-11-17T09:59:00.000
| 9 | 0.022219 | false | 1,747,772 | 0 | 0 | 1 | 1 |
I want to do full integration testing for a web application. I want to test many things like AJAX, positioning and presence of certain phrases and HTML elements using several browsers. I'm seeking a tool to do such automated testing.
On the other hand; this is my first time using integration testing. Are there any specific recommendations when doing such testing? Any tutorial as well?
(As a note: My backend code is done using Perl, Python and Django.)
Thanks!
|
Django development server CPU intensive - how to analyse?
| 1,756,874 | 18 | 7 | 3,645 | 0 |
python,django,cpu
|
FWIW, you should do the profiling, but when you do I'll bet you find that the answer is "polling for changes to your files so it can auto-reload." You might do a quick test with "python manage.py runserver --noreload" and see how that affects the CPU usage.
| 0 | 0 | 0 | 0 |
2009-11-17T18:01:00.000
| 4 | 1.2 | true | 1,750,676 | 0 | 0 | 1 | 2 |
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this?
Thanks!
Martin
|
Django development server CPU intensive - how to analyse?
| 1,750,793 | 4 | 7 | 3,645 | 0 |
python,django,cpu
|
Hit Control-C and crash the process. It will probably crash somewhere that it's spending a lot of time.
Or you could use a profiler.
| 0 | 0 | 0 | 0 |
2009-11-17T18:01:00.000
| 4 | 0.197375 | false | 1,750,676 | 0 | 0 | 1 | 2 |
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this?
Thanks!
Martin
|
Limit Python VM memory
| 1,760,046 | 12 | 20 | 13,726 | 0 |
python,memory,jvm
|
On *nix you can play around with the ulimit command, specifically the -m (max memory size) and -v (virtual memory).
| 0 | 0 | 0 | 0 |
2009-11-19T00:05:00.000
| 3 | 1.2 | true | 1,760,025 | 1 | 0 | 1 | 1 |
I'm trying to find a way to limit the memory available for the Python VM, as the option "-Xmx" in the Java VM does. (The idea is to be able to play with the MemoryError exception)
I'm not sure this option exist but there may be a solution using a command of the OS to "isolate" a process and its memory.
Thank you.
|
Shorten Python imports?
| 1,760,987 | 5 | 4 | 3,580 | 0 |
python,django
|
from myproject.folder import file (horrible name, btw, trampling over the builtin type file, but that's another rant;-), then use file.function -- if file (gotta hate that module name;-) is still too long for you, add e.g. as fi to the from statement, and use fi.function. If you want to rename myproject to myhorror, you only need to touch the from statements addressing it (you could use relative imports, but those would break 2.5 compatibility and therefore ban you from App Engine for now -- too high a price to pay for minor convenience, for me at least;-).
Edit: if just about every file needs some given supporting module, that's a powerful reason for making sure that supporting module lives in a directory (or zipfile) that's on sys.path (it's probably worth doing even if, say, only 30% of the files need that supporting module!-).
| 0 | 0 | 0 | 0 |
2009-11-19T04:53:00.000
| 3 | 1.2 | true | 1,760,963 | 1 | 0 | 1 | 1 |
I'm working on a Django project. Let's call it myproject. Now my code is littered with myproject.folder.file.function. Is there anyway I can remove the need to prefix all my imports and such with myproject.? What if I want to rename my project later? It kind of annoys me that I need to prefix stuff like that when the very file I'm importing it from is inside that same project. Shouldn't be necessary.
|
Different response by screen solutions using Django and jQuery
| 1,768,324 | 2 | 0 | 2,312 | 0 |
jquery,python,django
|
i think you have few options
Just change thumbnail at runtime based on $(window).width(); using jquery
Pass on screen resolution to django first time from client side, and later store it in session and render templates accordingly
Sometime you may get screen resolution in request headers, i am not sure though
Best would be to design a general solution which doesn't depend on screen resolution, and scaling 150x150 to 100x100 shouldn't be a problem on client side.
| 0 | 0 | 0 | 0 |
2009-11-20T03:34:00.000
| 1 | 1.2 | true | 1,768,179 | 0 | 0 | 1 | 1 |
In a thumbnail website, if I want to display 100x100 thumbs on screnn resolutions lower than 1280x1024 while display 150x150 thumbs for screens higher than 1280x1024, is the following procedure correct?
Render a page frame with no thumbs by view1()
On page frame loaded, it detects client's screen resolution and pass it to another Django view call fetchthumb()
View fetchthumb() create html code containing the thumb images and return to page frame.
jQuery on page frame render thumb html on browser.
Are there any better methods?
|
how to import contacts from various services like gmail or yahoo using python/django
| 11,819,696 | 1 | 5 | 2,955 | 0 |
python,django
|
Amir Hussain,
Yahoo mail using captcha, so it will not works for any scripts or service unless they have managed service with the help of a third party for captcha decoder. So u have to contact a service provider who provide managed service.
As far as I know, Improsys is the first Address Grabber marketer and they have managed service. They have this tool available for Classic ASP, ASP.Net, .Net, Ruby on Rails, PHP, Cold Fusion, JAVA, JSP and Perl. Microsoft Outlook and Outlook Express.
Actually I am using their service. Their service is satisfactory but the cost is too high.
| 0 | 0 | 0 | 1 |
2009-11-21T08:12:00.000
| 3 | 0.066568 | false | 1,774,915 | 0 | 0 | 1 | 1 |
How can I import contacts of given email id/pwd from
gmail
yahoo
hotmail
etc
using python/django application. Please suggest?
|
Python 3: Write newlines to HTML
| 1,776,100 | 7 | 7 | 25,316 | 0 |
python,html,unicode,python-3.x,newline
|
normally I do like this s=s.replace("\n","<br />\n")
because
<br /> is needed in web page display and
\n is needed in source display.
just my 2 cents
| 0 | 0 | 0 | 0 |
2009-11-21T17:11:00.000
| 6 | 1 | false | 1,776,066 | 1 | 0 | 1 | 1 |
I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML.
The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.
|
Django: request.META['REMOTE_ADDR'] is always '127.0.0.1'
| 1,779,475 | 7 | 2 | 4,509 | 0 |
python,django,http
|
Do you have any kind of proxy, gateway, or load balancer running on that remote host? That's the sort of thing that would cause connections to appear to be from 127.0.0.1 (because that's where the immediate connection is from, as far as the web server is concerned).
| 0 | 0 | 0 | 0 |
2009-11-22T18:10:00.000
| 2 | 1.2 | true | 1,779,464 | 0 | 0 | 1 | 1 |
I have an application running with debug=True on a remote host somewhere. Now somehow every time I access REMOTE_ADDR it returns 127.0.0.1 no matter where the request is from.
I'm not sure where to start and why this is happening.
|
How do I save to a field that is specified in a variable?
| 1,779,579 | 5 | 1 | 161 | 0 |
python,django,django-models
|
You can use: setattr(obj, fieldname, 'new name').
| 0 | 0 | 0 | 0 |
2009-11-22T18:45:00.000
| 1 | 1.2 | true | 1,779,567 | 0 | 0 | 1 | 1 |
I want to do something like this:
# models.py
class Model(models.Model):
name_in_my_model = models.CharField(max_length=100)
# later
fieldname = 'name_in_my_model'
# this is what I want to do somehow:
obj = Model.objects.get(pk=1)
obj.fieldname = 'new name'
obj.save()
Is this possible? I'm making a reusable application, and the user needs to specify a name of a field that is going to be updated by my app.
|
IronPython and pdb.set_trace()
| 1,781,255 | 3 | 6 | 1,056 | 0 |
ironpython,pdb
|
Yes, IronPython 2.6 supports this. By default this switches on when sys.settrace is called so frames already on the stack above the caller won't be available. But with the -X:Tracing option it's available all the time.
| 0 | 0 | 0 | 0 |
2009-11-22T22:34:00.000
| 1 | 0.53705 | false | 1,780,266 | 0 | 0 | 1 | 1 |
Does anyone know if IronPython 2.6 is planned to have support for pdb.set_trace() to enable setting breakpoints in an ironpython module? If not does anyone have a suggestion for accomplishing this without pdb?
|
Python for web scripting
| 1,784,843 | 2 | 1 | 756 | 0 |
python,html,web-applications,fastcgi,template-engine
|
You asked whether HTML is allowed within Python, which indicates that you still think too much in PHP terms about it. Contrary to PHP, Python was not designed to create dynamic web-pages. Instead, it was designed as a stand-alone, general-purpose programming language. Therefore you will not be able to put HTML into Python. There are some templating libraries which allow you to go the other way around, somewhat, but that's a completely different issue.
With things like Django or TurboGears or all the other web-frameworks, you essentially set up a small, stand-alone web-server (which comes bundled with the framework so you don't have to do anything), tell the server which function should handle what URL and then write those functions. In the simplest case, each URL you specify has its own function.
That 'handler function' (or 'view function' in Django terminology) receives a request object in which interesting info about the just-received request is contained. It then does whatever processing is required (a DB query for example). Finally, it produces some output, which is returned to the client. A typical way to get the output is to have some data passed to a template where it is rendered together with some HTML.
So, the HTML is separated in a template (in the typical case) and is not in the Python code.
About Python 3: I think you will find that the vast majority of all Python development going on in the world is still with Python 2.*. As others have pointed out here, Python 3 is just coming out, most of the good stuff is not available for it yet, and you shouldn't be bothered about that.
My advise: Grab yourself Python 2.6 and Django 1.1 and dive in. It's fun.
| 0 | 0 | 0 | 1 |
2009-11-23T06:28:00.000
| 3 | 0.132549 | false | 1,781,431 | 0 | 0 | 1 | 1 |
I'm just starting out with Python and have practiced so far in the IDLE interface. Now I'd like to configure Python with MAMP so I can start creating really basic webapps — using Python inside HTML, or well, vice-versa. (I'm assuming HTML is allowed in Python, just like PHP? If not, are there any modules/template engines for that?)
What modules do I need to install to run .py from my localhost? Googling a bit, it seems there're various methods — mod_python, FastCGI etc.. which one should I use and how to install it with MAMP Pro 1.8.2?
Many thanks
|
Python Vs Ruby On Rails : on Size
| 1,784,061 | 0 | 3 | 746 | 0 |
python,ruby-on-rails,django
|
With the cheeseshop, any python application can be made installable with a single command. I'm a big fan of Django, but it will require you to hook into an external webserver, as the built in server is for development only. You might look for something that has a more robust builtin web server if you want something you can just plunk down and start running. Twisted might meet your needs, though there's a bit more of a learning curve on that. I'm not sure how other python or ruby apps stand up on this front.
| 0 | 0 | 0 | 0 |
2009-11-23T14:26:00.000
| 7 | 0 | false | 1,783,431 | 0 | 0 | 1 | 5 |
I am planning to do a small web application that will be distributed as a single installable. I have plans to develop this application in either Python/Django or Ruby On Rails. (I am a Java/C++ programmer, hence both these languages are new to me).
My main concern is about the size and simplicity of final installable (say setup.exe). I want it to be small in size and also should be able to pack all required components in it.
Which one among Python/Django and Ruby On Rails is suitable for me?
|
Python Vs Ruby On Rails : on Size
| 1,783,732 | 1 | 3 | 746 | 0 |
python,ruby-on-rails,django
|
One option with Ruby on Rails is to go with a JRuby deployment which would allow you to pack it all into a single .war file. This would require the person deploying the web application to have a java web application server (Jetty is probably the smallest and easiest to bundle).
With Rails, you are generally going to have to install Ruby and any required ruby gems. The Ruby install is going to be machine specific- different for Windows/Linux. Everything else should be easily scripted. If you go with an Apache Passenger (mod_ruby) solution, you will need to get that installed as well.
In reality, I haven't run into many server applications with simple, compact installs.
| 0 | 0 | 0 | 0 |
2009-11-23T14:26:00.000
| 7 | 0.028564 | false | 1,783,431 | 0 | 0 | 1 | 5 |
I am planning to do a small web application that will be distributed as a single installable. I have plans to develop this application in either Python/Django or Ruby On Rails. (I am a Java/C++ programmer, hence both these languages are new to me).
My main concern is about the size and simplicity of final installable (say setup.exe). I want it to be small in size and also should be able to pack all required components in it.
Which one among Python/Django and Ruby On Rails is suitable for me?
|
Python Vs Ruby On Rails : on Size
| 1,783,478 | 4 | 3 | 746 | 0 |
python,ruby-on-rails,django
|
I personally prefer Python/django. Size is small given u have necessary things installed.
| 0 | 0 | 0 | 0 |
2009-11-23T14:26:00.000
| 7 | 0.113791 | false | 1,783,431 | 0 | 0 | 1 | 5 |
I am planning to do a small web application that will be distributed as a single installable. I have plans to develop this application in either Python/Django or Ruby On Rails. (I am a Java/C++ programmer, hence both these languages are new to me).
My main concern is about the size and simplicity of final installable (say setup.exe). I want it to be small in size and also should be able to pack all required components in it.
Which one among Python/Django and Ruby On Rails is suitable for me?
|
Python Vs Ruby On Rails : on Size
| 1,783,473 | 3 | 3 | 746 | 0 |
python,ruby-on-rails,django
|
With disk space at the current price, size shouldn't matter. Give both a try and figure out which will be easier for you to learn and maintain. Despite the fact that people believe that when you know one language, you know all, that's only true as long as you write code on the "hello world" level.
| 0 | 0 | 0 | 0 |
2009-11-23T14:26:00.000
| 7 | 0.085505 | false | 1,783,431 | 0 | 0 | 1 | 5 |
I am planning to do a small web application that will be distributed as a single installable. I have plans to develop this application in either Python/Django or Ruby On Rails. (I am a Java/C++ programmer, hence both these languages are new to me).
My main concern is about the size and simplicity of final installable (say setup.exe). I want it to be small in size and also should be able to pack all required components in it.
Which one among Python/Django and Ruby On Rails is suitable for me?
|
Python Vs Ruby On Rails : on Size
| 1,786,648 | 1 | 3 | 746 | 0 |
python,ruby-on-rails,django
|
I don't think you can get them both. I'm sorry to say this but you have to choose which one is more important to you.
Django application is smaller in size because many things is already provided out of the box, but deployment is not as easy.
On the other hand, RoR apps deployment is easier (both Ruby MRI or JRuby) but the application's size is naturally larger given you have to install other gems and Ruby On Rails plugins.
| 0 | 0 | 0 | 0 |
2009-11-23T14:26:00.000
| 7 | 0.028564 | false | 1,783,431 | 0 | 0 | 1 | 5 |
I am planning to do a small web application that will be distributed as a single installable. I have plans to develop this application in either Python/Django or Ruby On Rails. (I am a Java/C++ programmer, hence both these languages are new to me).
My main concern is about the size and simplicity of final installable (say setup.exe). I want it to be small in size and also should be able to pack all required components in it.
Which one among Python/Django and Ruby On Rails is suitable for me?
|
How to have a URL like this in Django?
| 1,788,452 | 3 | 2 | 712 | 0 |
python,django
|
http://example.com/my%20home/ is a valid URL where space character is escaped and Django will do all escaping/unescaping for you.
| 0 | 0 | 0 | 0 |
2009-11-24T07:25:00.000
| 6 | 0.099668 | false | 1,788,432 | 0 | 0 | 1 | 3 |
How can I have URLs like example.com/category/catename-operation/ in Django?
Also in some cases the user enters a space separated category, how can I handle that?
E.g if the user enters the category as "my home", then the URL for this category will become
example.com/my home/ which is not a valid URL.
How can I handle these things?
|
How to have a URL like this in Django?
| 1,788,715 | 0 | 2 | 712 | 0 |
python,django
|
How can I handle these things?
If you want to handle this thing, to obtain my-url, then use the form field clean method to return the valid url. Thats what it is meant for.
| 0 | 0 | 0 | 0 |
2009-11-24T07:25:00.000
| 6 | 0 | false | 1,788,432 | 0 | 0 | 1 | 3 |
How can I have URLs like example.com/category/catename-operation/ in Django?
Also in some cases the user enters a space separated category, how can I handle that?
E.g if the user enters the category as "my home", then the URL for this category will become
example.com/my home/ which is not a valid URL.
How can I handle these things?
|
How to have a URL like this in Django?
| 1,788,459 | 0 | 2 | 712 | 0 |
python,django
|
You could consider adding a URL-friendly name to your category and using that in the URL instead.
As another example you could have example.com/tv/ and have the category called "Televisions."
| 0 | 0 | 0 | 0 |
2009-11-24T07:25:00.000
| 6 | 0 | false | 1,788,432 | 0 | 0 | 1 | 3 |
How can I have URLs like example.com/category/catename-operation/ in Django?
Also in some cases the user enters a space separated category, how can I handle that?
E.g if the user enters the category as "my home", then the URL for this category will become
example.com/my home/ which is not a valid URL.
How can I handle these things?
|
Python on Rails?
| 1,794,205 | 14 | 23 | 23,732 | 0 |
python,ruby-on-rails,metaprogramming,code-translation
|
I think one of the things that people like about RoR is the domain-specific language (DSL) style of programming. This is something that Ruby is much better at than Python.
| 0 | 0 | 0 | 1 |
2009-11-25T01:56:00.000
| 4 | 1 | false | 1,794,179 | 0 | 0 | 1 | 1 |
Would it be possible to translate the Ruby on Rails code base to Python?
I think many people like Python more than Ruby, but find Ruby on Rails features better (as a whole) than the ones in Python web frameworks.
So that, would it be possible? Or does Ruby on Rails utilize language-specific features that would be difficult to translate to Python?
|
converting basic HTML to RML (Reportlab Markup Language)
| 1,842,295 | 1 | 2 | 2,613 | 0 |
python,reportlab
|
You shouldn't have much trouble doing this. Aside from some differences in element names, it's pretty straightforward: just ignore any HTML elements that can't be easily converted/you don't care about converting to RML and do the rest. I'm sure the ReportLab folks would be glad if you contributed even a basic HTML to RML parser to the project.
| 0 | 0 | 0 | 0 |
2009-11-25T07:59:00.000
| 2 | 1.2 | true | 1,795,349 | 0 | 0 | 1 | 1 |
Is there any Python library or some sample code which demonstrates how to convert basic HTML into RML (Reportlab Markup Language www.reportlab.org)? I can think of using a regular HTML parser and adding some home grown code to generate the RML, but I guess there will be a lot of cases to handle in such a conversion.
|
Point Django at different Python version
| 1,796,427 | 6 | 3 | 4,848 | 0 |
python,django,path
|
You have it backwards.
Django is added to Python's environment.
When you install a new Python, you must reinstall everything -- including Django -- for the new Python.
Once you have the new Django in the new Python, your PATH settings determine which Python you're using.
The version of Python (and the PYTHONPATH) determine which Django you'll use.
| 0 | 0 | 0 | 0 |
2009-11-25T10:46:00.000
| 3 | 1.2 | true | 1,796,105 | 1 | 0 | 1 | 3 |
Django application requires a later version of Python. I just installed it to 2.5 (from 2.4) and now when I do a python at the command line, it says 2.5.2.
Having said that, Django still says Python Version: 2.4.3.
How do I correct this? I've rebooted / restarted / redeployed to no avail.
|
Point Django at different Python version
| 1,796,381 | 4 | 3 | 4,848 | 0 |
python,django,path
|
How are you running Django? If it's via the development server, you can explicitly choose the version of Python you're using - python2.5 manage.py runserver.
However, if you're using mod_python or mod_wsgi these are fixed to the version of Python that was used when they were compiled. If you need to change this, you'll need to recompile, or find a packaged version for your distribution that uses the updated Python.
| 0 | 0 | 0 | 0 |
2009-11-25T10:46:00.000
| 3 | 0.26052 | false | 1,796,105 | 1 | 0 | 1 | 3 |
Django application requires a later version of Python. I just installed it to 2.5 (from 2.4) and now when I do a python at the command line, it says 2.5.2.
Having said that, Django still says Python Version: 2.4.3.
How do I correct this? I've rebooted / restarted / redeployed to no avail.
|
Point Django at different Python version
| 1,796,228 | 0 | 3 | 4,848 | 0 |
python,django,path
|
django uses /usr/bin/env python IIRC.
So, wherever your path points (which python) is the python that gets used. dependent upon your system, you can point your path to the python that you want to use. However, on some OS (CentOS for example) this is a bad idea.
| 0 | 0 | 0 | 0 |
2009-11-25T10:46:00.000
| 3 | 0 | false | 1,796,105 | 1 | 0 | 1 | 3 |
Django application requires a later version of Python. I just installed it to 2.5 (from 2.4) and now when I do a python at the command line, it says 2.5.2.
Having said that, Django still says Python Version: 2.4.3.
How do I correct this? I've rebooted / restarted / redeployed to no avail.
|
Correct place to put extra startup code in django?
| 1,797,198 | 4 | 7 | 5,120 | 0 |
python,django
|
If you don't want to use settings module, then try project's __init__.py.
| 0 | 0 | 0 | 0 |
2009-11-25T13:52:00.000
| 7 | 0.113791 | false | 1,797,046 | 0 | 0 | 1 | 4 |
I would like to run some environment checks when my django process starts and die noisily in the case of an error. I'm thinking things like the database has an incorrect encoding or the machine has a python version we don't support.
I'd rather our team be faced with a fatal error that they have to fix, rather than be able to ignore it.
I'm Ok with writing these checks but I'm curious about where the best place to put them is. How do I get them to execute as part of django's startup process? I thought there might be a signal I could listen too, but I can't find a relevant one in the docs.
|
Correct place to put extra startup code in django?
| 1,798,361 | 4 | 7 | 5,120 | 0 |
python,django
|
We use the top-level urls.py for this.
| 0 | 0 | 0 | 0 |
2009-11-25T13:52:00.000
| 7 | 0.113791 | false | 1,797,046 | 0 | 0 | 1 | 4 |
I would like to run some environment checks when my django process starts and die noisily in the case of an error. I'm thinking things like the database has an incorrect encoding or the machine has a python version we don't support.
I'd rather our team be faced with a fatal error that they have to fix, rather than be able to ignore it.
I'm Ok with writing these checks but I'm curious about where the best place to put them is. How do I get them to execute as part of django's startup process? I thought there might be a signal I could listen too, but I can't find a relevant one in the docs.
|
Correct place to put extra startup code in django?
| 3,154,109 | 0 | 7 | 5,120 | 0 |
python,django
|
You can put it in settings.py as mentioned by others, but having code in the settings is not ideal. There is also the option of adding a handler for django.db.models.signals.class_prepared that does the desired start up checks after a specific model class is prepared.
| 0 | 0 | 0 | 0 |
2009-11-25T13:52:00.000
| 7 | 0 | false | 1,797,046 | 0 | 0 | 1 | 4 |
I would like to run some environment checks when my django process starts and die noisily in the case of an error. I'm thinking things like the database has an incorrect encoding or the machine has a python version we don't support.
I'd rather our team be faced with a fatal error that they have to fix, rather than be able to ignore it.
I'm Ok with writing these checks but I'm curious about where the best place to put them is. How do I get them to execute as part of django's startup process? I thought there might be a signal I could listen too, but I can't find a relevant one in the docs.
|
Correct place to put extra startup code in django?
| 13,517,044 | 3 | 7 | 5,120 | 0 |
python,django
|
I have tested all three __init__.py Settings.py and urls.py methods and this is what I have found.
When code is run from either __init__.py or Settings.py, the start up functions are run twice upon web server start up; when the start up functions are run from urls.py the code is run once, however it is run only upon the first request made to the we server leading to a potentially long wait for the first user to visit your site.
It is standard practise to call a 'warming' page when bringing large web applications back online so I don't see that calling a start up function from a CLEARLY identified location in the urls.py should be a problem.
| 0 | 0 | 0 | 0 |
2009-11-25T13:52:00.000
| 7 | 0.085505 | false | 1,797,046 | 0 | 0 | 1 | 4 |
I would like to run some environment checks when my django process starts and die noisily in the case of an error. I'm thinking things like the database has an incorrect encoding or the machine has a python version we don't support.
I'd rather our team be faced with a fatal error that they have to fix, rather than be able to ignore it.
I'm Ok with writing these checks but I'm curious about where the best place to put them is. How do I get them to execute as part of django's startup process? I thought there might be a signal I could listen too, but I can't find a relevant one in the docs.
|
Launching default application for given type of file, OS X
| 1,798,364 | 1 | 2 | 576 | 0 |
python,subprocess
|
Do you know about the open command in Mac OS X? I think you can solve your problem by calling it from Python.
man open for details:
The open command opens a file (or a directory or URL), just as if you had double-clicked the
file's icon. If no application name is specified, the default application as determined via
LaunchServices is used to open the specified files.
| 0 | 1 | 0 | 0 |
2009-11-25T16:56:00.000
| 3 | 0.066568 | false | 1,798,351 | 0 | 0 | 1 | 2 |
I'm writing a python script that generates html file. Every time I run this script I'd like at the end to open default system browser for this file. It's all in OS X environment.
What python code can launch Safari/Firefox/whatever is system default html viewer and open given file? subprocess.call doesn't seem to do the trick.
|
Launching default application for given type of file, OS X
| 1,799,054 | 0 | 2 | 576 | 0 |
python,subprocess
|
import ic
ic.launchurl('file:///somefile.html')
| 0 | 1 | 0 | 0 |
2009-11-25T16:56:00.000
| 3 | 0 | false | 1,798,351 | 0 | 0 | 1 | 2 |
I'm writing a python script that generates html file. Every time I run this script I'd like at the end to open default system browser for this file. It's all in OS X environment.
What python code can launch Safari/Firefox/whatever is system default html viewer and open given file? subprocess.call doesn't seem to do the trick.
|
What is the performance cost of named keys or "pre-generated" keys in Google App Engine?
| 1,805,774 | 4 | 2 | 198 | 0 |
python,google-app-engine
|
There is no intrinsic penalty to using a key name instead of an auto-generated ID, except the overhead of a (potentially) longer key on the entity and any ReferenceProperties that reference it.
In certain cases, in fact, using auto-allocated IDs can have a performance penalty: If you insert new entities at a very high rate (several hundred per second), since all the new entities have IDs in the same range, they will all be written to the same Bigtable tablet, and can cause contention and increased timeouts. The vast majority of apps never have to worry about this, though.
There's no performance impact to allocating as many IDs as you want - App Engine simply increases the ID counter by the number you request. (This is a simplification, but generally accurate).
In answer to your concerns, App Engine doesn't randomly generate keys. It either uses an auto-allocated id, which is allocated using a counter, and thus guaranteed unique, or it uses the key you supplied. So in answer to your last 3 bullet points:
No.
Only in storage for the (potentially) longer keys
No, and the cost is roughly O(1) regardless of how many you ask for.
| 0 | 1 | 0 | 0 |
2009-11-26T20:38:00.000
| 1 | 1.2 | true | 1,805,555 | 0 | 0 | 1 | 1 |
If you used named keys in Google App Engine, does this incur any additional cost? Put another way, is it any more expensive to create a new entity with a named key rather than a randomly generated id?
In a similar line of reasoning, I note that you can ask Google App Engine to give you a set of keys that will not be used by Google App Engine as auto generated keys? Would generating a large number of these keys result in reduced performance?
These questions both bother me for the following reason. Let us say Google App Engine was attempting to persist entity A, and as such it is creating a key for A. It would seem intuitively, that when a new key is randomly generated, Google App Engine would need to first check if the key was already in existence. If the key already existed, then Google App Engine might need to generate another randomly generated new key. It would continue to do this until it succeeded in generating a unique new key. It would then assign this key to entity A. Alright, that is fine and good.
My problem with this is it seems to imply that keys cause some sort of application level lock? This would be neccesary when Google App Engine is checking if the randomly generated key already exist. This can't be right, as it isn't scalable at all? What is wrong about my reasoning?
So, since this was long, I will re-iterate my 3 questions:
Does Google App Engine create an application level lock when generating new keys?
Do named keys incur any additional cost over automatically generated keys? If so, what cost (constant, linear, exponential,...)?
Does asking app engine for keys that app engine promises not to use cause a degradation in key creation performance? If so, what would the cost for this be?
|
"Permission Denied" in Django template using Djapian
| 1,806,773 | 2 | 0 | 2,652 | 0 |
python,django,search,django-templates,xapian
|
Please figure out what is the exact file path involved in this error. I guess it involves a write operation to some template cache, but you should make sure.
Then you just need to check the UNIX permissions on the file accessed or on the directory for that file in the case of a newly created file.
Another possibility is to run your application via strace (it is a command line tool, see man strace) and try to search for such an error (13) in its output. It'll show you the exact path involved in the problem.
| 0 | 0 | 0 | 0 |
2009-11-27T01:56:00.000
| 1 | 1.2 | true | 1,806,449 | 0 | 0 | 1 | 1 |
I've followed the Djapian tutorial and setup everything "by the book" so that the indexshell commandline supplied by Djapian shows successful queries.
However, when integrating the sample search from the Djapian tutorial I get this nonsense error:
TemplateSyntaxError at /search/
Caught an exception while rendering: (13, 'Permission denied')
It points to this line:
{% if results %}
Changing or omitting the line will yield the next (same) error at whichever line that references a field from "results".
The stacktrace shows this exception:
OSError(13, 'Permission denied')
in:
/usr/local/lib/python2.6/dist-packages/django/template/debug.py in render_node
django-debug-toolbar shows for results:
<djapian.resultset.ResultSet object at 0x7f7142affcd0>
Is this an issue with Djapian? In any case, why would it yield a "Permission denied" error?
|
Why does my python script randomly get killed?
| 1,811,196 | 1 | 17 | 20,694 | 0 |
python,mysql,url
|
Is it possible that it's hitting an uncaught exception? Are you running this from a shell, or is it being run from cron or in some other automated way? If it's automated, the output may not be displayed anywhere.
| 0 | 0 | 1 | 0 |
2009-11-28T00:47:00.000
| 5 | 0.039979 | false | 1,811,173 | 0 | 0 | 1 | 2 |
Basically, i have a list of 30,000 URLs.
The script goes through the URLs and downloads them (with a 3 second delay in between).
And then it stores the HTML in a database.
And it loops and loops...
Why does it randomly get "Killed."? I didn't touch anything.
Edit: this happens on 3 of my linux machines.
The machines are on a Rackspace cloud with 256 MB memory. Nothing else is running.
|
Why does my python script randomly get killed?
| 1,811,350 | 1 | 17 | 20,694 | 0 |
python,mysql,url
|
Are you using some sort of queue manager or process manager of some sort ?
I got apparently random killed messages when the batch queue manager I was using was sending SIGUSR2 when the time was up.
Otherwise I strongly favor the out of memory option.
| 0 | 0 | 1 | 0 |
2009-11-28T00:47:00.000
| 5 | 0.039979 | false | 1,811,173 | 0 | 0 | 1 | 2 |
Basically, i have a list of 30,000 URLs.
The script goes through the URLs and downloads them (with a 3 second delay in between).
And then it stores the HTML in a database.
And it loops and loops...
Why does it randomly get "Killed."? I didn't touch anything.
Edit: this happens on 3 of my linux machines.
The machines are on a Rackspace cloud with 256 MB memory. Nothing else is running.
|
python and securing pyc files on disk
| 1,814,092 | 1 | 1 | 1,262 | 0 |
python,security
|
To add a little bit to S.Lott's comment: The code portion of your blog should be stored in a location where it can be executed (e.g. via a web request), but not read directly. Any reasonable web server providing CGI support will allow this to be set up.
| 0 | 0 | 0 | 0 |
2009-11-28T23:00:00.000
| 2 | 0.099668 | false | 1,814,053 | 0 | 0 | 1 | 1 |
I set django's settings.py file to chmod 600 to keep felonious folks from spying my database connection info, but on import python compiles this file and writes out settings.pyc as mode 644. It doesn't take much sleuthing for the bad guys to get the info they need from this compiled version. I fear my blog entries are in grave danger.
Beyond the obvious os.chmod, what techniques folks use to keep your compiled python secure on disk?
|
Allow only one concurrent login per user in django app
| 1,814,465 | 0 | 2 | 13,565 | 0 |
python,django
|
I'm going to assume that you mean logged in at once, and not one "login" at the same time.
I've never written a Django application before. But one method I've used in other languages, is to store the session ID of the logged in user in their user row in the database.
For example, if you have a users table in your database, add a field "session_id" and then when the user logs in, set that to their current session_id. On every page load check to see if their current session matches the session_id in the users table. Remember whenever you regenerate their session_id in your application, you'll need to update the database so they don't get logged out.
Some people when a user logs in, just store all the users details into a session and never re-call the database on a new page load. So for some this "extra" SQL query might seem wrong. For me, I always do a new query on each page load to re-authenticate the user and make sure their account wasn't removed/suspended and to make sure their username/password combo is still the same. (What if someone from another location changed the password, or an administrator?)
| 0 | 0 | 0 | 0 |
2009-11-29T02:20:00.000
| 4 | 0 | false | 1,814,437 | 0 | 0 | 1 | 1 |
is it possible to allow only one concurrent login per user in django application? if yes, how do you approach?
|
Javascript communication with Selenium (RC)
| 1,902,514 | 1 | 3 | 2,109 | 0 |
javascript,python,testing,selenium,selenium-rc
|
If you are purely testing that the JavaScript functions are performing the correct calculations with the given inputs, I would suggest separating your JavaScript from your page and use a JavaScript testing framework to test the functionality. Testing low level code using Selenium is a lot of unnecessary overhead. If you're going against the fully rendered page, this would require your application to be running to a server, which should not be a dependency of testing raw JavaScript.
We recently converted our application from using jsUnit to use YUI Test and it has been promising so far. We run about 150 tests in both FireFox and IE in less than three minutes. Our testing still isn't ideal - we still test a lot of JavaScript the hard way using Selenium. However, moving some of the UI tests to YUI Test has saved us a lot of time in our Continuous Integration environment.
| 0 | 0 | 1 | 0 |
2009-11-30T13:42:00.000
| 2 | 0.099668 | false | 1,819,903 | 0 | 0 | 1 | 1 |
My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to how this calculation is going on, and so we can easily spot any NaNs creeping in.
We are planning to integrate Selenium (RC with python) to test or project, but if we could get the console output messages in the python test case, we can identify any NaNs or even any miscalculations.
So, is there a way that Selenium can absorb these outputs (preferably in a console-less environment)?
If not, I would like to know if I can divert the console calls, may be by rebinding the console variable to something else, so that selenium can get that output and notify the python side. Or if not console, is there any other way that I can achieve this.
I know selenium has commands like waitForElementPresent etc., but I don't want to show these intermediate calculations on the application, or is it the only way?
Any help appreciated.
Thank you.
|
Set and use flags against a users profile model in Django
| 1,823,488 | 0 | 0 | 1,168 | 0 |
python,django,django-models
|
There are a variety of ways to do this. I suggest the following:
Django has a messaging framework, built by design to show messages to users only once when the software creates them. Whenever X is created/modified/deleted etc, you can add the message to the user via User.message_set.create(message='Whatever you like'). This will be shown to the user once. This relies on django sessions, which I assume you're using since you're relying on the built-in user model. These messages are stored in auth_message.
HTH
| 0 | 0 | 0 | 0 |
2009-12-01T00:46:00.000
| 2 | 0 | false | 1,823,372 | 0 | 0 | 1 | 1 |
I have a simple webapp in Django for an iPhone app.
I want to prompt the user to review our product, but just once. I then don't want to show that prompt again.
So would the best practise way of implementing this to be to add a new entry to the user profile model with a bolean field: "reviewed" - and then set that flag when the user completes the action?
I would then check for that entry in my template and display or not, the prompt.
I've not yet worked with database models, extended the user model, or saved to custom DB fields, so any thoughts or examples on this would be most welcome. I'm a little nervous as my site has live users and I won't want to break the user tables.
|
Good way to pass variables for common elements to Mako templates?
| 1,830,276 | 0 | 1 | 1,022 | 0 |
python,mako
|
You have two OO design choices for your page controllers.
Common features can be handled two ways.
Inheritance. All page controllers are subclasses of a common class that provides the common attributes.
Delegation. All page controllers are part of a pipeline where some common process (either before or after the page controller) folds in the additional information.
You have to pick one.
| 0 | 0 | 0 | 0 |
2009-12-02T01:03:00.000
| 1 | 1.2 | true | 1,830,042 | 0 | 0 | 1 | 1 |
I'm using Mako's inheritance features to factor out common page elements, like a header and footer, into a "base.mako" template. Page-specific controllers use their own templates, which inherit base.mako.
base.mako needs a set of variables -- for example, the name of the logged-on user goes in the header for all pages. However, it's the individual page controller that selects and renders the template, and is therefore responsible for passing variables to it.
I'd rather all of those page controllers not have to know what the base template needs in its context. What's a good way to establish the context for the base template in a situation like this?
Thanks in advance!
|
Python after Ruby on Rails
| 1,864,605 | 1 | 2 | 1,541 | 0 |
python,ruby-on-rails,pylons
|
Clarity and ease of use are some of Pythons biggest selling points. In saying that, the different Python web frameworks cover almost the entire spectrum from small and simple all the way up to large and complex with everything in between.
You should find that most Python web frameworks have less 'magic' than Rails - ie they are a bit more explicit which is arguably better from the clarity point of view.
In my opinion, even if you enjoy Rails and don't ever plan on leaving, you should still try out other languages and frameworks occasionally to give you a broader perspective.
Personally I like Turbogears2, but I think Django would make a good starting point for a Rails developer that wanted to try out something else.
| 0 | 0 | 0 | 1 |
2009-12-02T18:22:00.000
| 5 | 0.039979 | false | 1,834,829 | 0 | 0 | 1 | 1 |
I have been working with Ruby on Rails for over a year now and have been offered some development work with Python. I would like know if development with Python is as enjoyable as Ruby in terms of the clarity and ease of use. And how well is Python suited for Web development. I've heard of Pylons being a direct port of the Rails framework but does it provide the same level of comfort and features. Are there any popular websites built using Python and a framework that offers the same level of flexibilty as Rails.
Because Rails doesn't seem like work.
|
What Python-only HTTP/1.1 web servers are available?
| 1,837,070 | 1 | 2 | 507 | 0 |
python,http
|
also:
web.py (webpy.org)
paste (pythonpaste.org)
| 0 | 0 | 1 | 0 |
2009-12-02T20:43:00.000
| 3 | 0.066568 | false | 1,835,668 | 0 | 0 | 1 | 1 |
There is CherryPy. Are there any others?
|
Automate interaction with a webpage in python
| 1,837,397 | 6 | 4 | 9,387 | 0 |
python,google-app-engine,pycurl
|
Twill and mechanize don't do Javascript, and Qt and Selenium can't run on App Engine ((1)), which only supports pure Python code. I do not know of any pure-Python Javascript interpreter, which is what you'd need to deploy a JS-supporting scraper on App Engine:-(.
Maybe there's something in Java, which would at least allow you to deploy on (the Java version of) App Engine? App Engine app versions in Java and Python can use the same datastore, so you could keep some part of your app in Python... just not the part that needs to understand Javascript. Unfortunately I don't know enough about the Java / AE environment to suggest any specific package to try.
((1)): to clarify, since there seems to be a misunderstanding that has gotten so far as to get me downvoted: if you run Selenium or other scrapers on a different computer, you can of course target a site deployed in App Engine (it doesn't matter how the website you're targeting is deployed, what programming language[s] it uses, etc, etc, as long as it's a website you can access [[real website: flash, &c, may likely be different]]). How I read the question is, the OP is looking for ways to have the scraping run as part of an App Engine app -- that is the problematic part, not where you (or somebody else;-) runs the site being scraped!
| 0 | 0 | 1 | 0 |
2009-12-03T00:59:00.000
| 5 | 1 | false | 1,836,987 | 0 | 0 | 1 | 1 |
I want to automate interaction with a webpage. I've been using pycurl up til now but eventually the webpage will use javascript so I'm looking for alternatives . A typical interaction is "open the page, search for some text, click on a link (which opens a form), fill out the form and submit".
We're deploying on Google App engine, if that makes a difference.
Clarification: we're deploying the webpage on appengine. But the interaction is run on a separate machine. So selenium seems like it's the best choice.
|
How to get the URL Image which is displyed by script
| 1,870,291 | 0 | 0 | 163 | 0 |
python
|
if you just want to download the image, theres two strategies you can try:
use a something like Firebug or Chrome developer tools. right click the element in question, click "inspect element", and look at the css properties of the element. if you look around, you should find something like background-image style or maybe just a normal tag. then you'll have the url to the image.
use a something like Firebug or Chrome developer tools: look in the "resources" tab, and look for image files that show up.
| 0 | 0 | 1 | 0 |
2009-12-03T06:26:00.000
| 3 | 0 | false | 1,838,047 | 0 | 0 | 1 | 2 |
When I view the source of page, I do not find the image src. but the image is displayed on the page. This image is generated by some server side code.
I am using the selenium for testing. I want to download this image for verification/comparison.
How to get that image using python?
|
How to get the URL Image which is displyed by script
| 1,838,243 | 0 | 0 | 163 | 0 |
python
|
If you aren't seeing an actual image tag in the HTML, your next step would seem to be figuring out how its being displayed.
The first place I'd suggest looking is in the .css files for this page. Images can actually be embedded using CSS, and this seems like the next likely option after being in the HTML code itself.
If it isn't in there, you may be dealing with some form of technique deliberately intended to prevent you from being able to download the image with a script. This may use obfuscated JavaScript or something similar and I wouldn't expect people to be able to give you an easy solution to bypass it (since it was carefully designed to resist exactly that).
| 0 | 0 | 1 | 0 |
2009-12-03T06:26:00.000
| 3 | 0 | false | 1,838,047 | 0 | 0 | 1 | 2 |
When I view the source of page, I do not find the image src. but the image is displayed on the page. This image is generated by some server side code.
I am using the selenium for testing. I want to download this image for verification/comparison.
How to get that image using python?
|
python web app logging through pipe? (performance concerned)
| 1,839,366 | 1 | 0 | 514 | 0 |
python,logging,pipe
|
Pipes are one of the fastest I/O mechanisms available. It's just a shared buffer. Nothing more. If the receiving end of your pipe is totally overwhelmed, you may have an issue. But you have no evidence of that right now.
If you have 10's of processes started by FastCGI, each can have their own independent log file. That's the ideal situation: use Python logging -- make each process have a unique log file.
In the rare event that you need to examine all log files, cat them together for analysis.
| 0 | 1 | 0 | 1 |
2009-12-03T11:28:00.000
| 1 | 1.2 | true | 1,839,348 | 0 | 0 | 1 | 1 |
I'm writing a web app using python with web.py, and I want to implement my own logging system. I'd like to log detailed information about each request that come to python (static files are handled by web servers).
Currently I'm thinking about writing the logs to a pipe. On the other side, there should be cronolog.
My main concern is that will the performance be good? How is the time/resource consumed in piping the logs compared to the normal processing of a request (less than 5 database queries, and page generation from templates)?
Or are there other better approaches? I don't want to write the log file in python because tens of processes will be started by fastcgi.
|
Facebook login without opening another window/popup
| 1,844,379 | 0 | 0 | 1,221 | 0 |
python,facebook
|
The opening of a window for facebook auth is the way facebook set up their authentication for facebook connect.
I don't think they offer another way of authenticating users, and I doubt you'd be able to work-around/circumvent this method without breaking their terms of use
Sorry I don't have better news for you :/
| 0 | 0 | 0 | 0 |
2009-12-03T19:36:00.000
| 1 | 1.2 | true | 1,842,360 | 0 | 0 | 1 | 1 |
Is it possible for web application that is created by the same owner as facebook application to have access to facebook application without going through a explicit session opening exercise?
Most of the work is done on server side and I need to access facebook application directly from backend server. Each time the website loads I do not want user to go through the facebook connect experience as data to be displayed does not require his facebook profile/data access.
Let me know if its possible?
Although its not related to language, I would be grateful if help is provided keeping python in mind. Thx
|
Timer object in Django
| 1,842,622 | 1 | 0 | 2,462 | 0 |
python,django,timer
|
You should not use some in-process/memory timer objects since your django app can run in multiple processes...
I suggest create this "timers" in database (like "expire" datetime field for your product model) and use cron job that will mark expired objects to be available
| 0 | 0 | 0 | 0 |
2009-12-03T20:15:00.000
| 3 | 0.066568 | false | 1,842,593 | 0 | 0 | 1 | 3 |
I'm using Django to create registration/payment application for a limited number of products. I want to create a timer so that when a user chooses to purchase a product, that product will then displayed as "already taken". But, if the user the user does not go through with the purchase and the timer runs out, the product goes back to status "available". If the user completes the purchase, the timer should cancel, leaving the product's status permanently as "already taken".
I've tried using python's dictionary to instantiate python Timer objects of the fly, but about 30% of the time, I get a "key error" when it's time to cancel the Timer.
Please. Could someone give me an idea on the proper way to do this in Django?
Thanks very much!
Mark
|
Timer object in Django
| 1,842,666 | -2 | 0 | 2,462 | 0 |
python,django,timer
|
Fork it. Have your model use three states for a product: available, taken, and purchased. When a user initiates an action that marks the product as taken, spawn a new process that will mark the product to available in 3 minutes if it is not purchased.
| 0 | 0 | 0 | 0 |
2009-12-03T20:15:00.000
| 3 | 1.2 | true | 1,842,593 | 0 | 0 | 1 | 3 |
I'm using Django to create registration/payment application for a limited number of products. I want to create a timer so that when a user chooses to purchase a product, that product will then displayed as "already taken". But, if the user the user does not go through with the purchase and the timer runs out, the product goes back to status "available". If the user completes the purchase, the timer should cancel, leaving the product's status permanently as "already taken".
I've tried using python's dictionary to instantiate python Timer objects of the fly, but about 30% of the time, I get a "key error" when it's time to cancel the Timer.
Please. Could someone give me an idea on the proper way to do this in Django?
Thanks very much!
Mark
|
Timer object in Django
| 1,842,844 | 6 | 0 | 2,462 | 0 |
python,django,timer
|
I would not use a timer for such situation because it can give some complexity. What will happen to your timers if the process is restarted. That't the case with some internet providers who restart the process on a regular basis. Maybe you are facing a similar situation.
I would add a 'taken_time' datetimefield to your table to know when the product is taken and use it in order to know if the product is available or not
The list of available products would be filled with the 'available' products and the 'taken' if their 'taken_time' is lower than (current time - accepted delay)
I think you don't really need to change the status with an external process as long as you manage it correctly in your business logic.
I hope it helps
PS: Sorry for my english! Quite late in France now and difficult for me to find simple way to explain my view :-)
| 0 | 0 | 0 | 0 |
2009-12-03T20:15:00.000
| 3 | 1 | false | 1,842,593 | 0 | 0 | 1 | 3 |
I'm using Django to create registration/payment application for a limited number of products. I want to create a timer so that when a user chooses to purchase a product, that product will then displayed as "already taken". But, if the user the user does not go through with the purchase and the timer runs out, the product goes back to status "available". If the user completes the purchase, the timer should cancel, leaving the product's status permanently as "already taken".
I've tried using python's dictionary to instantiate python Timer objects of the fly, but about 30% of the time, I get a "key error" when it's time to cancel the Timer.
Please. Could someone give me an idea on the proper way to do this in Django?
Thanks very much!
Mark
|
Best XMPP Library for Python Web Application
| 1,881,020 | 0 | 3 | 1,373 | 0 |
javascript,python,xmpp,wsgi
|
I have found a lot of issues with Openfire and TLS are not with the xmpp lib :( -- SleekXMPP in the trunk has been converted to Python 3.0 and the branch is maintained for Python 2.5
Unlike Julien, I would only go with Twisted Words if you really need the power of Twisted or if you are already using Twisted. IMO SleekXMPP offers the closest match to the current XEP's in use today.
| 0 | 0 | 1 | 0 |
2009-12-04T14:02:00.000
| 3 | 0 | false | 1,847,120 | 0 | 0 | 1 | 1 |
I want to learn how to use XMPP and to create a simple web application with real collaboration features.
I am writing the application with Python(WSGI), and the application will require javascript enabled because I am going to use jQuery or Dojo.
I have downloaded Openfire for the server and which lib to choose? SleekXMPP making trouble with tlslite module(python 2.5 and I need only python 2.6).
What is your suggestion?
|
Objective reasons for using Python or Ruby for a new REST Web API
| 1,850,652 | 5 | 6 | 3,675 | 0 |
python,ruby,web-services,api,rest
|
I know Ruby, don't know python... you can see which way I'm leaning toward, right?
| 0 | 0 | 0 | 0 |
2009-12-05T00:55:00.000
| 7 | 1.2 | true | 1,850,640 | 0 | 0 | 1 | 5 |
So this thread is definitely NOT a thread for why Python is better than Ruby or the inverse. Instead, this thread is for objective criticism on why you would pick one over the other to write a RESTful web API that's going to be used by many different clients, (mobile, web browsers, tablets etc).
Again, don't compare Ruby on Rails vs Django. This isn't a web app that's dependent on high level frameworks such as RoR or Django. I'd just like to hear why someone might choose one over the other to write a RESTful web API that they had to start tomorrow, completely from scratch and reasons they might go from one to another.
For me, syntax and language features are completely superfluous. The both offer an abundant amount of features and certainly both can achieve the same exact end goals. I think if someone flips a coin, it's a good enough reason to use one over the other. I'd just love to see what some of you web service experts who are very passionate about their work respond to why they would use one over the other in a very objective format.
|
Objective reasons for using Python or Ruby for a new REST Web API
| 1,850,653 | 4 | 6 | 3,675 | 0 |
python,ruby,web-services,api,rest
|
Choose the one you're most familiar with and most likely to get things done with the fastest.
| 0 | 0 | 0 | 0 |
2009-12-05T00:55:00.000
| 7 | 0.113791 | false | 1,850,640 | 0 | 0 | 1 | 5 |
So this thread is definitely NOT a thread for why Python is better than Ruby or the inverse. Instead, this thread is for objective criticism on why you would pick one over the other to write a RESTful web API that's going to be used by many different clients, (mobile, web browsers, tablets etc).
Again, don't compare Ruby on Rails vs Django. This isn't a web app that's dependent on high level frameworks such as RoR or Django. I'd just like to hear why someone might choose one over the other to write a RESTful web API that they had to start tomorrow, completely from scratch and reasons they might go from one to another.
For me, syntax and language features are completely superfluous. The both offer an abundant amount of features and certainly both can achieve the same exact end goals. I think if someone flips a coin, it's a good enough reason to use one over the other. I'd just love to see what some of you web service experts who are very passionate about their work respond to why they would use one over the other in a very objective format.
|
Objective reasons for using Python or Ruby for a new REST Web API
| 1,850,743 | 2 | 6 | 3,675 | 0 |
python,ruby,web-services,api,rest
|
I think they are fairly evenly matched in features. I prefer Python, but I have been using it for over a decade so I freely admit that what follows is totally biased.
IMHO Python is more mature - there are more libraries for it (although Ruby may be catching up), and the included libraries I think are better designed. The language evolution process is more mature too, with each proposed feature discussed in public via the PEPs before the decision is made to include them in a release. I get the impression that development of the Ruby language is much more ad-hoc.
Python is widely used in a lot of areas apart from web development - scientific computing, CGI rendering pipelines, distributed computing, Linux GUI tools etc. Ruby got very little attention before Rails came along, so I get the impression that most Ruby work is focused on web development. That may not be a problem if that is all you want to do with the language, but it does mean that Python has a more diverse user base and a more diverse set of libraries.
Python is faster too.
| 0 | 0 | 0 | 0 |
2009-12-05T00:55:00.000
| 7 | 0.057081 | false | 1,850,640 | 0 | 0 | 1 | 5 |
So this thread is definitely NOT a thread for why Python is better than Ruby or the inverse. Instead, this thread is for objective criticism on why you would pick one over the other to write a RESTful web API that's going to be used by many different clients, (mobile, web browsers, tablets etc).
Again, don't compare Ruby on Rails vs Django. This isn't a web app that's dependent on high level frameworks such as RoR or Django. I'd just like to hear why someone might choose one over the other to write a RESTful web API that they had to start tomorrow, completely from scratch and reasons they might go from one to another.
For me, syntax and language features are completely superfluous. The both offer an abundant amount of features and certainly both can achieve the same exact end goals. I think if someone flips a coin, it's a good enough reason to use one over the other. I'd just love to see what some of you web service experts who are very passionate about their work respond to why they would use one over the other in a very objective format.
|
Objective reasons for using Python or Ruby for a new REST Web API
| 1,852,162 | 1 | 6 | 3,675 | 0 |
python,ruby,web-services,api,rest
|
Either will do a great job and you'll gain in other ways from learning something new. Why not spend as couple of days with each? See how far you can get with a simple subset of the problem, then see how you feel. For bonus points report back here and answer your own question!
| 0 | 0 | 0 | 0 |
2009-12-05T00:55:00.000
| 7 | 0.028564 | false | 1,850,640 | 0 | 0 | 1 | 5 |
So this thread is definitely NOT a thread for why Python is better than Ruby or the inverse. Instead, this thread is for objective criticism on why you would pick one over the other to write a RESTful web API that's going to be used by many different clients, (mobile, web browsers, tablets etc).
Again, don't compare Ruby on Rails vs Django. This isn't a web app that's dependent on high level frameworks such as RoR or Django. I'd just like to hear why someone might choose one over the other to write a RESTful web API that they had to start tomorrow, completely from scratch and reasons they might go from one to another.
For me, syntax and language features are completely superfluous. The both offer an abundant amount of features and certainly both can achieve the same exact end goals. I think if someone flips a coin, it's a good enough reason to use one over the other. I'd just love to see what some of you web service experts who are very passionate about their work respond to why they would use one over the other in a very objective format.
|
Objective reasons for using Python or Ruby for a new REST Web API
| 1,850,701 | 6 | 6 | 3,675 | 0 |
python,ruby,web-services,api,rest
|
I would say the important thing is that regardless of which you choose, make sure that your choice does not leak through your REST API. It should not matter to the client of your API which you chose.
| 0 | 0 | 0 | 0 |
2009-12-05T00:55:00.000
| 7 | 1 | false | 1,850,640 | 0 | 0 | 1 | 5 |
So this thread is definitely NOT a thread for why Python is better than Ruby or the inverse. Instead, this thread is for objective criticism on why you would pick one over the other to write a RESTful web API that's going to be used by many different clients, (mobile, web browsers, tablets etc).
Again, don't compare Ruby on Rails vs Django. This isn't a web app that's dependent on high level frameworks such as RoR or Django. I'd just like to hear why someone might choose one over the other to write a RESTful web API that they had to start tomorrow, completely from scratch and reasons they might go from one to another.
For me, syntax and language features are completely superfluous. The both offer an abundant amount of features and certainly both can achieve the same exact end goals. I think if someone flips a coin, it's a good enough reason to use one over the other. I'd just love to see what some of you web service experts who are very passionate about their work respond to why they would use one over the other in a very objective format.
|
Ruby Quiz for Python
| 1,852,706 | 1 | 2 | 463 | 0 |
python
|
At the risk of stating the obvious, why not just do the rubyquiz examples in python. Those exercises as well as others aren't tied to a language - you're just as well off just doing projecteuler problems in python rather than searching for python-specific puzzles. A puzzle is a puzzle a language is just a tool to solve it.
| 0 | 0 | 0 | 1 |
2009-12-05T06:52:00.000
| 2 | 0.099668 | false | 1,851,396 | 0 | 0 | 1 | 1 |
Is there a blog/forum/listserv that is equivalent to RubyQuiz.com for the Python language?
|
Writing a Faster Python Spider
| 1,853,865 | 3 | 6 | 7,091 | 0 |
python,web-crawler
|
You waste a lot of time waiting for network requests when spidering, so you'll definitely want to make your requests in parallel. I would probably save the result data to disk and then have a second process looping over the files searching for the term. That phase could easily be distributed across multiple machines if you needed extra performance.
| 0 | 0 | 1 | 0 |
2009-12-05T22:28:00.000
| 6 | 0.099668 | false | 1,853,673 | 0 | 0 | 1 | 3 |
I'm writing a spider in Python to crawl a site. Trouble is, I need to examine about 2.5 million pages, so I could really use some help making it optimized for speed.
What I need to do is examine the pages for a certain number, and if it is found to record the link to the page. The spider is very simple, it just needs to sort through a lot of pages.
I'm completely new to Python, but have used Java and C++ before. I have yet to start coding it, so any recommendations on libraries or frameworks to include would be great. Any optimization tips are also greatly appreciated.
|
Writing a Faster Python Spider
| 1,854,592 | 0 | 6 | 7,091 | 0 |
python,web-crawler
|
What Adam said. I did this once to map out Xanga's network. The way I made it faster is by having a thread-safe set containing all usernames I had to look up. Then I had 5 or so threads making requests at the same time and processing them. You're going to spend way more time waiting for the page to DL than you will processing any of the text (most likely), so just find ways to increase the number of requests you can get at the same time.
| 0 | 0 | 1 | 0 |
2009-12-05T22:28:00.000
| 6 | 0 | false | 1,853,673 | 0 | 0 | 1 | 3 |
I'm writing a spider in Python to crawl a site. Trouble is, I need to examine about 2.5 million pages, so I could really use some help making it optimized for speed.
What I need to do is examine the pages for a certain number, and if it is found to record the link to the page. The spider is very simple, it just needs to sort through a lot of pages.
I'm completely new to Python, but have used Java and C++ before. I have yet to start coding it, so any recommendations on libraries or frameworks to include would be great. Any optimization tips are also greatly appreciated.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.