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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
| 2,578,635 | 31 | 21 | 30,143 | 0 |
python,django,cakephp,web-frameworks,yii
|
This is a very subjective question but personally I'd recommend Django. Python is a very nice language to use and the Django framework is small, easy to use, well documented and also has a pretty active community.
This choice was made partly because of my dislike for PHP though, so take the recommendation with a pinch of salt.
| 0 | 0 | 0 | 1 |
2010-04-05T13:18:00.000
| 8 | 1 | false | 2,578,540 | 0 | 0 | 1 | 5 |
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site.
Thanks,
niting
|
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
| 2,578,670 | 29 | 21 | 30,143 | 0 |
python,django,cakephp,web-frameworks,yii
|
Most of the frameworks out there nowadays are fast enough to serve whatever needs you will have. It really depends on in which environment you feel most comfortable. Though there are nuances here and there, MVC frameworks share a lot of the same principles, so whichever you choose to use is really a matter of which you most enjoy using.
So, if you like Python more, there's your answer. Use a Python framework, and Django is the best. If you like PHP more (which I personally don't), you've got some more decisions to make. But any of the PHP frameworks are fine. They really are. Just pick one that looks nice with comprehensive documentation and get to work.
| 0 | 0 | 0 | 1 |
2010-04-05T13:18:00.000
| 8 | 1.2 | true | 2,578,540 | 0 | 0 | 1 | 5 |
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good experience with python and PHP but I have no idea how to use either of the framework. We have plenty of time to experiment and learn one of the above frameworks.Could you please specify which one would be preferred for such a scenario considering speed, features, and security of the site.
Thanks,
niting
|
Using set with values from a table
| 2,579,922 | 1 | 3 | 85 | 1 |
python,sql,mysql,django-models
|
The answer is clear too. You will need not a field, but another films_actors table. This table would act as your field, but much more reliable. This is called many-to-many relation.
| 0 | 0 | 0 | 0 |
2010-04-05T17:31:00.000
| 2 | 0.099668 | false | 2,579,866 | 0 | 0 | 1 | 1 |
I'm writing a database of all DVDs I have at home.
One of the fields, actors, I would like it to be a set of values from an other table, which is storing actors. So for every film I want to store a list of actors, all of which selected from a list of actors, taken from a different table.
Is it possible? How do I do this? It would be a set of foreign keys basically.
I'm using a MySQL database for a Django application (python), so any hint in SQL or Python would be much appreciated.
I hope the question is clear,
many thanks.
|
Unittest in Django. Static variable feeded into the test case
| 2,580,813 | 3 | 2 | 399 | 0 |
python,django,unit-testing
|
This is normal unittest behavior, though you would normally set up the test data in the setUp() method instead of __init__ (and destroy it in tearDown() perhaps).
If generating your dynamic test data takes to long to perform for each test case method, then I guess the best way to go is to create a singleton test data class. In this case you would have to take care that each test method leaves the test data class in exactly the same state it found it, which is not trivial if you want your test case methods to write something in it; this is the reason why unittest try to re-generate the test environment for every test case method.
One improvement might be to have the singleton test data class return a deep-copy of itself every time you request it's instance.
| 0 | 0 | 0 | 0 |
2010-04-05T19:35:00.000
| 1 | 1.2 | true | 2,580,648 | 0 | 0 | 1 | 1 |
I want to generate some dynamic data and feed these data in to test cases. But I found that Django will initial the test class every time to do the test. So the data will get generated every time django test framework calls the function.
Is there anyway to use something like the singleton or static variable to solve the problem? What should be the solution?
Thanks!
|
Disable autocomplete on textfield in Django?
| 3,672,334 | 33 | 28 | 19,773 | 0 |
python,django,forms,autocomplete
|
Add the autocomplete="off" to the form tag, so you don't have to change the django.form instance.
<form action="." method="post" autocomplete="off">
{{ form }}
</form>
| 0 | 0 | 0 | 0 |
2010-04-05T20:23:00.000
| 5 | 1 | false | 2,580,955 | 0 | 0 | 1 | 1 |
Does anyone know how you can turn off autocompletion on a textfield in Django?
For example, a form that I generate from my model has an input field for a credit card number. It is bad practice to leave autocompletion on. When making the form by hand, I'd add a autocomplete="off" statement, but how do you do it in Django and still retain the form validation?
|
What's the easiest way to get my facebook status and photos using python?
| 2,582,677 | 0 | 0 | 2,103 | 0 |
python,django,facebook,pyfacebook
|
Probably. Anything that bypassed authentication would be a fairly large privacy issue.
| 0 | 0 | 0 | 0 |
2010-04-06T04:21:00.000
| 3 | 0 | false | 2,582,627 | 0 | 0 | 1 | 1 |
I just want to import my facebook status and photos to my personal django website but all the examples and documentation i can find are for developing facebook applications.
A simple rss feed would be enough but it doesnt seem to exist in facebook.
Do i really have to create a full facebook app to do this?
|
How to use ';' (semicolon) in urls, using Google Appengine
| 5,877,046 | 0 | 2 | 336 | 0 |
python,google-app-engine,url
|
Issue816 has now been fixed, semi-colons are usable with appengine.
| 0 | 1 | 0 | 0 |
2010-04-07T12:54:00.000
| 2 | 1.2 | true | 2,592,540 | 0 | 0 | 1 | 1 |
Using the local dev server, I can use ';' in urls, but as soon as I try the live version hosted by Google, it looks like the ';' and everything afterward is stripped (at least according to request.path_qs).
(I would prefer not to encode them if possible, it's much less user friendly if the url cannot be constructed by copy-pasting, especially since other characters works fine, e.g. ':').
|
Running Java, Python, Ruby and Perl programs in .NET
| 2,593,537 | 7 | 0 | 421 | 0 |
java,.net,python,ruby,perl
|
Do you want to run programs in these languages inside the .NET platform? You'd need IronPython or IronRuby (I don't think anything like IronPerl exists).
If you want to run "normal" Python/Ruby/Perl/Java programs, then yes, you'll need to install a Python interpreter, a Ruby interpreter, a Perl interpreter and a Java VM.
| 0 | 0 | 0 | 0 |
2010-04-07T15:02:00.000
| 4 | 1.2 | true | 2,593,519 | 1 | 0 | 1 | 3 |
I've .NET framework 3.5 installed in my laptop. Just .NET alone, no Visual Studio. How can I run Java, Python, Ruby and Perl programs from the console?
Do I need to install something else also, for running these language files?
In case there is a need for something extra to be installed and after i have all of them, what are the commands that I need to type in the console to run these programs?
|
Running Java, Python, Ruby and Perl programs in .NET
| 2,593,551 | 3 | 0 | 421 | 0 |
java,.net,python,ruby,perl
|
None of those languages are supported natively with .NET. You can try IronPython or IronRuby for those languages, but to run Java or Perl I think you'll actually need to download and install a Java VM and a perl interpreter.
| 0 | 0 | 0 | 0 |
2010-04-07T15:02:00.000
| 4 | 0.148885 | false | 2,593,519 | 1 | 0 | 1 | 3 |
I've .NET framework 3.5 installed in my laptop. Just .NET alone, no Visual Studio. How can I run Java, Python, Ruby and Perl programs from the console?
Do I need to install something else also, for running these language files?
In case there is a need for something extra to be installed and after i have all of them, what are the commands that I need to type in the console to run these programs?
|
Running Java, Python, Ruby and Perl programs in .NET
| 2,593,556 | 1 | 0 | 421 | 0 |
java,.net,python,ruby,perl
|
There's no practical common virtual machine or binary for the options you list. You will require a separate install for each of these (note that all are unrelated to .NET)
| 0 | 0 | 0 | 0 |
2010-04-07T15:02:00.000
| 4 | 0.049958 | false | 2,593,519 | 1 | 0 | 1 | 3 |
I've .NET framework 3.5 installed in my laptop. Just .NET alone, no Visual Studio. How can I run Java, Python, Ruby and Perl programs from the console?
Do I need to install something else also, for running these language files?
In case there is a need for something extra to be installed and after i have all of them, what are the commands that I need to type in the console to run these programs?
|
Is there a way to backup everything in an app-engine blobstore?
| 2,594,009 | 2 | 3 | 645 | 0 |
python,google-app-engine,blobstore
|
In Java, you would instantiate a BlobInfoFactory and use BlobInfoFactory.queryBlobInfos.
Then for each blob, you would run BlobstoreService.serve(...) with the BlobKeys returned from the BlobInfos. You still might end up with broken entity relationships - there's no way to guarantee each blob will end up with the same key it was originally loaded with. You'll have to account for this in your application.
| 0 | 1 | 0 | 0 |
2010-04-07T15:31:00.000
| 1 | 0.379949 | false | 2,593,756 | 0 | 0 | 1 | 1 |
bulkloader.py is very handy.
But as far as I can tell it doesn't appear to fetch items from the blobstore, so you can be left with broken entity relationships if you needed to dump/restore your application.
Does anyone know a method for completely backing up their data from app-engine including blobstore data?
|
Why would Django fcgi just die? How can I find out?
| 2,664,142 | 0 | 6 | 916 | 0 |
python,django,logging,crash,lighttpd
|
Have had the same problems. Not only do they die without warning or reason they leak like crazy too with threads being stuck without a master process. We solved this problem by having a cronjob run every 5 minutes that checks if the port number is up and running and if not restart.
By the way, we've now (slowly migrating) given up on fcgi and moved over to uwsgi.
| 0 | 0 | 0 | 1 |
2010-04-08T13:32:00.000
| 3 | 0 | false | 2,600,212 | 0 | 0 | 1 | 2 |
I'm running Django on Linux using fcgi and Lighttpd. Every now and again (about once a day) the server just dies. I'm using the latest stable release of Django, Python and Lighttpd.
The only thing I can think of is that my program is opening a lot of files and executing a lot of external processes, but I'm fairly sure that side of things is watertight.
Looking at the error and access logs, there's nothing exceptional happening (i.e. load isn't above normal). On those occasions where I have had exceptions from Python, these have shown up in the error.log, but when this crash happens I get nothing.
Is there any way of finding out why the process died? Short of putting logging statements on every single line? Obviously I can't reproduce this so I don't know exactly where to look.
Edit
It's the django process that's dying. I'm running the server with manage.py runfcgi daemonize=true method=threaded host=127.0.0.1 port=12345
|
Why would Django fcgi just die? How can I find out?
| 2,653,742 | 0 | 6 | 916 | 0 |
python,django,logging,crash,lighttpd
|
Is this on your server? (do you own the box?). I've had that problem on shared hosting, and the host was just killing long processes. Do you know if your fcgi is receiving a SIGTERM?
| 0 | 0 | 0 | 1 |
2010-04-08T13:32:00.000
| 3 | 0 | false | 2,600,212 | 0 | 0 | 1 | 2 |
I'm running Django on Linux using fcgi and Lighttpd. Every now and again (about once a day) the server just dies. I'm using the latest stable release of Django, Python and Lighttpd.
The only thing I can think of is that my program is opening a lot of files and executing a lot of external processes, but I'm fairly sure that side of things is watertight.
Looking at the error and access logs, there's nothing exceptional happening (i.e. load isn't above normal). On those occasions where I have had exceptions from Python, these have shown up in the error.log, but when this crash happens I get nothing.
Is there any way of finding out why the process died? Short of putting logging statements on every single line? Obviously I can't reproduce this so I don't know exactly where to look.
Edit
It's the django process that's dying. I'm running the server with manage.py runfcgi daemonize=true method=threaded host=127.0.0.1 port=12345
|
How to use the validation rules on both client-side and server-side?
| 2,606,444 | 2 | 9 | 926 | 0 |
jquery,python,django,validation
|
No, no such thing exists.
Yes, you need to code it yourself.
However, I imagine you could possibly create widgets which are able to deliver generic validation js routines based on the modelFields. Such as "This should be chars not more than max_length". However they could not trivially generate client-side code to validate any custom validation written in python, nor even something like "This must be the username of an existing user". But if you take this trouble to build widgets which do basic validation based on the modelFields please contribute them to open source :-D
| 0 | 0 | 0 | 0 |
2010-04-09T09:29:00.000
| 3 | 0.132549 | false | 2,606,283 | 0 | 0 | 1 | 1 |
I'm using jQuery validation system for client-side validation. The backend works with django.
jQuery use an interesting set of rules in JSON format.
Does exists something to use the same rules on django side or I need to code it myself?
|
ISBNs are used as primary key, now I want to add non-book things to the DB - should I migrate to EAN?
| 2,610,094 | 3 | 2 | 1,516 | 1 |
python,django,postgresql,isbn
|
I don't know postgres but normally ISBM would be a unique index key but not the primary. It's better to have an integer as primary/foreign key. That way you only need to add a new field EAN/ISSN as nullable.
| 0 | 0 | 0 | 0 |
2010-04-09T18:45:00.000
| 4 | 0.148885 | false | 2,610,000 | 0 | 0 | 1 | 2 |
I built an inventory database where ISBN numbers are the primary keys for the items. This worked great for a while as the items were books. Now I want to add non-books. some of the non-books have EANs or ISSNs, some do not.
It's in PostgreSQL with django apps for the frontend and JSON api, plus a few supporting python command-line tools for management. the items in question are mostly books and artist prints, some of which are self-published.
What is nice about using ISBNs as primary keys is that in on top of relational integrity, you get lots of handy utilities for validating ISBNs, automatically looking up missing or additional information on the book items, etcetera, many of which I've taken advantage. some such tools are off-the-shelf (PyISBN, PyAWS etc) and some are hand-rolled -- I tried to keep all of these parts nice and decoupled, but you know how things can get.
I couldn't find anything online about 'private ISBNs' or 'self-assigned ISBNs' but that's the sort of thing I was interested in doing. I doubt that's what I'll settle on, since there is already an apparent run on ISBN numbers.
should I retool everything for EAN numbers, or migrate off ISBNs as primary keys in general? if anyone has any experience with working with these systems, I'd love to hear about it, your advice is most welcome.
|
ISBNs are used as primary key, now I want to add non-book things to the DB - should I migrate to EAN?
| 2,614,029 | 1 | 2 | 1,516 | 1 |
python,django,postgresql,isbn
|
A simple solution (although arguably whether good) would be to use (isbn,title) or (isbn,author) which should pretty much guarantee uniqueness. Ideology is great but practicality also serves a purpose.
| 0 | 0 | 0 | 0 |
2010-04-09T18:45:00.000
| 4 | 0.049958 | false | 2,610,000 | 0 | 0 | 1 | 2 |
I built an inventory database where ISBN numbers are the primary keys for the items. This worked great for a while as the items were books. Now I want to add non-books. some of the non-books have EANs or ISSNs, some do not.
It's in PostgreSQL with django apps for the frontend and JSON api, plus a few supporting python command-line tools for management. the items in question are mostly books and artist prints, some of which are self-published.
What is nice about using ISBNs as primary keys is that in on top of relational integrity, you get lots of handy utilities for validating ISBNs, automatically looking up missing or additional information on the book items, etcetera, many of which I've taken advantage. some such tools are off-the-shelf (PyISBN, PyAWS etc) and some are hand-rolled -- I tried to keep all of these parts nice and decoupled, but you know how things can get.
I couldn't find anything online about 'private ISBNs' or 'self-assigned ISBNs' but that's the sort of thing I was interested in doing. I doubt that's what I'll settle on, since there is already an apparent run on ISBN numbers.
should I retool everything for EAN numbers, or migrate off ISBNs as primary keys in general? if anyone has any experience with working with these systems, I'd love to hear about it, your advice is most welcome.
|
Django project models.py versus app models.py
| 2,610,788 | 6 | 18 | 11,119 | 0 |
python,django,django-models
|
Django models can only reside in applications, not in project itself. By default manage.py inspectdb outputs content of the models.py file and it's up to you to put it in the right place.
In your case it would be easier to put whole thing in one app and later split it in the places where it would make sense.
I'm not sure what's the state with the current version, but before presence of models module in package was indication that this is django application and can be put in INSTALLED_APPS list.
| 0 | 0 | 0 | 0 |
2010-04-09T20:35:00.000
| 3 | 1 | false | 2,610,727 | 0 | 0 | 1 | 1 |
I am learning Django and I am trying to understand the use of models.py in the project versus the application. It seems from the tutorial examples that I include a model definition in the app, but when I went to apply that knowledge to my own existing database I got stuck.
I took a database that I use (a copy of course) and generated the conceptual schema as a django model using inspectdb. I did this at the project level, and presumed then I could write apps using subschemas in the applications for that project.
But generalizing the tutorial, they define the model in the application's model.py. If I did that, I would be repeating the model (or part of it) that's already at the project level, which seems like a mistake and a maintenance issue.
So how, in Django style, do I use the project schema (or parts of it) without redefining it in the application's models.py?
Thanks in advance.
|
Python Desktop Application with the Browser as an interface?
| 2,611,928 | 2 | 27 | 25,678 | 0 |
python,browser,desktop,httpserver
|
There are plenty of excellent GUI tools for the way you want to do your GUI -- HTML, CSS, and Javascript. If you don't know of any, ask in a separate question with the right tags.
The Python side in such an arrangement should have no GUI of its own, but just run a subclass of the Python's standard library's HTTP server, just serving the HTML, CSS, and JS files, and data via JSON on other URLs that the JS can reach with Ajax techniques, essentially implementing storage and business logi -- so it's far from obvious what "GUI tool" you could possibly want for it?!
Just develop the Python side on its own (e.g. with IDLE, Wingware, SPE, or whatever you like) and the HTML / CSS / Javascript separately, with its own "GUI tool". All that Python will do with those files is statically serve them, after all.
You could be thinking of using some Python side templating, such as Mojo &c, but my recommendation is to avoid that: rather, go with the "thin server architecture" all the way, make the Python side a RESTful server of business logic and storage layers, and do all the GUI work in the browser instead.
| 0 | 0 | 1 | 0 |
2010-04-10T01:45:00.000
| 5 | 0.07983 | false | 2,611,910 | 0 | 0 | 1 | 1 |
I want to create an application that runs on the users computer, a stand-alone application, with installation and what-not, but I want the interface to be a browser, either internal and displayed as an OS window or external accessible using the browser (i.e. some http server).
The reason would be because I know a little about Python, but I think I can manage as long as I have some basic roots that I can use and manipulate, and those would be HTML, CSS, and Javascript.
I've yet to find a good GUI tool which I can use, and always abandon the idea after trying to mess around and eventually not getting anything.
|
Storing URLs while Spidering
| 2,615,862 | 4 | 7 | 1,194 | 0 |
python,database,url,storage,web-crawler
|
It depends on the scale of the spidering you're going to be doing, and the kind of machine you're doing it on. Suppose a typical URL is a string of 60 bytes or so, an in-memory set will take a bit more than 100 bytes per URL (sets and dicts in Python are never allowed to grow beyond 60% full, for speed reasons). If you have a 64-bit machine (and Python distro) with about 16 GB of RAM available, you could surely devote over 10 GB to the crucial set in question, letting you easily spider about 100 million URLs or so; but at the other extreme, if you have a 32-bit machine with 3GB of RAM, you clearly can't devote much more than a GB to the crucial set, limiting you to about 10 million URLs. Sqlite would help around the same range of sized where a 32-bit machine couldn't make it but a generously-endowed 64-bit one could -- say 100 or 200 million URLs.
Beyond those, I'd recommend PostgreSQL, which also has the advantage of being able to run on a different machine (on a fast LAN) with basically no problems, letting you devote your main machine to spidering. I guess MySQL &c would be OK for that too, but I love PostgreSQL standard compliance and robustness;-). This would allow, say, a few billion URLs with no problems (just a fast disk, or better a RAID arrangement, and as much RAM as you can afford to speed things up, of course).
Trying to save memory/storage by using a fixed-length hash in lieu of URLs that might be quite long is fine if you're OK with an occasional false positive that will stop you from crawling what's actually a new URL. Such "collisions" need not be at all likely: even if you only use 8 bytes for the hash, you should only have a substantial risk of some collision when you're looking at billions of URLs (the "square root heuristic" for this well-known problem).
With 8-bytes strings to represent the URLs, the in-memory set architecture should easily support a billion URLs or more on a well-endowed machine as above outlined.
So, roughly how many URLs do you want to spider, and how much RAM can you spare?-)
| 0 | 0 | 0 | 0 |
2010-04-11T02:19:00.000
| 6 | 0.132549 | false | 2,615,830 | 0 | 0 | 1 | 3 |
I created a little web spider in Python which I'm using to collect URLs. I'm not interested in the content. Right now I'm keeping all the visited URLs in a set in memory, because I don't want my spider to visit URLs twice. Of course that's a very limited way of accomplishing this.
So what's the best way to keep track of my visited URLs?
Should I use a database?
which one? MySQL, SQLite, PostgreSQL?
how should I save the URLs? As a primary key trying to insert every URL before visiting it?
Or should I write them to a file?
one file?
multiple files? how should I design the file-structure?
I'm sure there are books and a lot of papers on this or similar topics. Can you give me some advice what I should read?
|
Storing URLs while Spidering
| 2,615,836 | 7 | 7 | 1,194 | 0 |
python,database,url,storage,web-crawler
|
These seem to be the important aspects to me:
You can't keep the URLs in memory as RAM will get too high
You need fast existence lookups at least O(logn)
You need fast insertions
There are many ways to do this and it depends on how big your database will get. I think an SQL database can provide a good model for your problem.
Probably all you need is an SQLite database. Typically string lookups for existence check is a slow operation. To speed this up you can create a CRC hash of the URL and store both the CRC and URL in your database. You would have an index on that CRC field.
When you insert: You insert the URL and the hash
When you want to do an existance lookup: You take the CRC of the potentially new URL and check if it is in your database already.
There is of course a chance of collision on the URL hashes, but if 100% spanning is not important to you then you can take the hit of not having a URL in your DB when there is a collision.
You could also decrease collisions in many ways. For example you can increase the size of your CRC (CRC8 instead of CRC4) and use a hashing algorithm with a bigger size. Or use CRC as well as URL length.
| 0 | 0 | 0 | 0 |
2010-04-11T02:19:00.000
| 6 | 1.2 | true | 2,615,830 | 0 | 0 | 1 | 3 |
I created a little web spider in Python which I'm using to collect URLs. I'm not interested in the content. Right now I'm keeping all the visited URLs in a set in memory, because I don't want my spider to visit URLs twice. Of course that's a very limited way of accomplishing this.
So what's the best way to keep track of my visited URLs?
Should I use a database?
which one? MySQL, SQLite, PostgreSQL?
how should I save the URLs? As a primary key trying to insert every URL before visiting it?
Or should I write them to a file?
one file?
multiple files? how should I design the file-structure?
I'm sure there are books and a lot of papers on this or similar topics. Can you give me some advice what I should read?
|
Storing URLs while Spidering
| 2,615,904 | 9 | 7 | 1,194 | 0 |
python,database,url,storage,web-crawler
|
I've written a lot of spiders. To me, a bigger problem than running out of memory is the potential of losing all the URLs you've spidered already if the code or machine crashes or you decide you need to tweak the code. If you run out of RAM most machines and OSes these days will page so you'll slow down but still function. Having to rebuild a set of URLs gathered over hours and hours of run-time because its no longer available can be a real blow to productivity.
Keeping information in RAM that you do NOT want to lose is bad. Obviously a database is the way to go at that point because you need fast random access to see if you've already found a URL. Of course in-memory lookups are faster but the trade-off of figuring out WHICH urls to keep in memory adds overhead. Rather than try writing code to determine which URLs I need/don't-need, I keep it in the database and concentrate on making my code clean and maintainable and my SQL queries and schemas sensible. Make your URL field a unique index and the DBM will be able to find them in no time while automatically avoiding redundant links.
Your connection to the internet and sites you're accessing will probably be a lot slower than your connection to a database on a machine on your internal network. A SQLite database on the same machine might be the fastest, though the DBM itself isn't as sophisticated as Postgres, which is my favorite. I found that putting the database on another machine on the same switch as my spidering machine to be extremely fast; Making one machine handle the spidering, parsing, and then the database reads/writes is pretty intensive so if you have an old box throw Linux on it, install Postgres, and go to town. Throw some extra RAM in the box if you need more speed. Having that separate box for database use can be very nice.
| 0 | 0 | 0 | 0 |
2010-04-11T02:19:00.000
| 6 | 1 | false | 2,615,830 | 0 | 0 | 1 | 3 |
I created a little web spider in Python which I'm using to collect URLs. I'm not interested in the content. Right now I'm keeping all the visited URLs in a set in memory, because I don't want my spider to visit URLs twice. Of course that's a very limited way of accomplishing this.
So what's the best way to keep track of my visited URLs?
Should I use a database?
which one? MySQL, SQLite, PostgreSQL?
how should I save the URLs? As a primary key trying to insert every URL before visiting it?
Or should I write them to a file?
one file?
multiple files? how should I design the file-structure?
I'm sure there are books and a lot of papers on this or similar topics. Can you give me some advice what I should read?
|
Does python-memcached support consistent hashing & binary protocol?
| 2,616,824 | 2 | 4 | 2,396 | 0 |
python,django,memcached,python-memcached,consistent-hashing
|
Looking at the _get_server method on python-memcached v1.45, it seems it doesn't use consistent hashing, but a simple hash % len(buckets).
Same goes for binary protocol, python-memcache uses, as far as I can see in the source, only text commands.
| 0 | 0 | 0 | 0 |
2010-04-11T09:45:00.000
| 6 | 1.2 | true | 2,616,610 | 0 | 0 | 1 | 1 |
Python-memcached is the official supported memcached driver for Django.
Does it support
Consistent hashing
Binary protocol
If it does, how do I use those features within Django? I couldn't find any documentation.
|
How to convert Selenese (html) to Python programmatically?
| 2,620,931 | 0 | 6 | 2,514 | 0 |
python,selenium,selenium-rc,selenium-ide
|
No there isn't a way but in theory it shouldn't be too difficult to do as all you need to do is have something that uses the python-rc.js to convert the file.
| 0 | 0 | 1 | 0 |
2010-04-11T16:16:00.000
| 2 | 0 | false | 2,617,684 | 0 | 0 | 1 | 1 |
How would I convert test cases made by Selenium IDE to Python without exporting every test case by hand? Is there any command line converter for that job?
In the end I want to use Selenium RC and Pythons build in unittest to test my websites.
Thanks a lot.
Update:
I started to write a converter but its too much work to implement all the commands. Is there any better way?
from xml.dom.minidom import parse
class SeleneseParser:
def __init__(self,selFile):
self.dom = parse(selFile)
def getTestName(self):
return self.dom.getElementsByTagName('title')[0].firstChild.data
def getBaseUrl(self):
return self.dom.getElementsByTagName('link')[0].getAttribute('href')
def getNodes(self):
cmds = []
nodes = self.dom.getElementsByTagName('tbody')[0].childNodes
for node in nodes:
if node.nodeType == node.TEXT_NODE and "\n" in node.data:
continue
if node.nodeType == node.COMMENT_NODE:
cmds.append(node.data)
if node.nodeType == node.ELEMENT_NODE:
cmd = []
for c in node.childNodes:
if c.nodeType == node.ELEMENT_NODE:
if len(c.childNodes) == 1:
cmd.append(c.childNodes[0].data)
else:
cmd.append("")
cmds.append(cmd)
return cmds
class PythonConverter:
def __init__(self,sourceFile):
self.parser = SeleneseParser(sourceFile)
self.dest = u'# -*- coding: utf-8 -*-\n\nfrom selenium import selenium\nimport unittest, time, re\n'
def getHeader(self):
self.dest += u'\nclass %s(unittest.TestCase):\n' % self.parser.getTestName()
self.dest += u'\tdef setUp(self):\n\t\tself.verificationErrors = []\n'
self.dest += u'\t\tself.selenium = selenium("localhost", 4444, "*chrome", "%s")\n' % self.parser.getBaseUrl()
self.dest += u'\t\tself.selenium.start()\n'
def getContent(self):
self.dest += u'\n\tdef test_%s(self):\n\t\tsel = self.selenium\n' % self.parser.getTestName()
nodes = self.parser.getNodes()
for node in nodes:
if type(node) is list:
cmd,target,value = node[0],node[1],node[2]
if cmd == 'store':
self.dest += u'\t\t%s = "%s"\n' % (value,target)
elif cmd == 'clickAndWait':
self.dest += u'\t\tsel.click(u"%s")\n\t\tsel.wait_for_page_to_load("30000")\n' % (target)
elif cmd == 'type':
self.dest += u'\t\tsel.%s(u"%s", u"%s")\n' % (cmd,target,value)
elif cmd == 'select':
self.dest += u'\t\tsel.select(u"%s", u"%s")\n' % (target,value)
elif cmd == 'verifyTextPresent':
self.dest += u'\t\ttry: self.failUnless(sel.is_text_present(u"%s"))\n\t\texcept AssertionError, e: self.verificationErrors.append(str(e))\n' % target
elif cmd == 'verifySelectedLabel':
self.dest += u'\t\ttry: self.assertEqual(u"%s", sel.get_selected_label(u"%s"))\n\t\texcept AssertionError, e: self.verificationErrors.append(str(e))\n' % (value,target)
elif cmd == 'verifyValue':
self.dest += u'\t\ttry: self.assertEqual(u"%s", sel.get_value(u"%s"))\n\t\texcept AssertionError, e: self.verificationErrors.append(str(e))\n' % (value,target)
elif cmd == 'verifyText':
self.dest += u'\t\ttry: self.assertEqual(u"%s", sel.get_text(u"%s"))\n\t\texcept AssertionError, e: self.verificationErrors.append(str(e))\n' % (value,target)
elif cmd == 'verifyElementPresent':
self.dest += u'\t\ttry: self.failUnless(sel.is_element_present(u"%s"))\n\t\texcept AssertionError, e: self.verificationErrors.append(str(e))\n' % (target)
else:
self.dest += u'\t\tsel.%s(u"%s")\n' % (cmd,target)
#print cmd,target,value
else:
self.dest += u'\t\t#%s\n' % node
def getFooter(self):
self.dest += u'\n\tdef tearDown(self):\n\t\tself.selenium.stop()\n\t\tself.assertEqual([], self.verificationErrors)\n'
self.dest += u'\nif __name__ == "__main__":\n\tunittest.main()'
def convert(self):
self.getHeader()
self.getContent()
self.getFooter()
return self.dest
p = PythonConverter('test_case.html')
print p.convert()
|
Mod_wsgi versus fapws3 - Django
| 2,633,716 | 3 | 0 | 853 | 0 |
python,django,mod-wsgi,wsgi,fapws3
|
The underlying web server is not the bottleneck, it is your application and database access. The differences between any underlying web server are going to very minimal or non existent in the context of an actual full application stack. You cannot base decisions on hello world type tests as they are pretty meaningless. Decisions should therefore be based on the quality and stability of the hosting solutions under load, as well as ease of configuration and support, including your own competence to manage a particular setup. If you have no idea how to configure and support a particular web server properly, eg., Apache, then why would you use it.
| 0 | 0 | 0 | 1 |
2010-04-13T11:26:00.000
| 2 | 0.291313 | false | 2,629,070 | 0 | 0 | 1 | 1 |
is there a difference between using FAPWS3 and MOD_WSGI when dealing with Django?
FAPWS3 seems alot faster when serving requests toward Python scripts. I would like to know if I'm missing out anything. :)
Any ideas?
|
Generate an image / thumbnail of a webpage using X/Gui-less linux
| 14,925,431 | 1 | 0 | 353 | 0 |
php,python,linux,image-processing
|
I'll never get back the time I wasted on wkhtml and Xvfb, along with the joy of embedding a monolithic binary from google onto my system. You can save yourself a lot of time and headache by abandoning wkhtml2whatever completely and installing phantom.js. Once I did that, I had five lines of shell code and beautiful images in no time.
I had a single problem - using ww instead of www in a url caused the process to fail without meaningful error messages. Eventually I saw the dns lookup problem, and my faith was restored.
But seriously, every other avenue of thumbnailing seemed to be out of date and/or buggy.
phantom.js = it changed my life.
| 0 | 0 | 0 | 0 |
2010-04-13T17:40:00.000
| 2 | 0.099668 | false | 2,631,813 | 0 | 0 | 1 | 1 |
There exists numerous solutions on generating a thumbnail or an image preview of a webpage. Some of these solutions are webs-based like websnapshots, windows libraries such as PHP's imagegrabscreen (only works on windows), and KDE's wkhtml. Many more do exist.
However, I'm looking for a GUI-less solution. Something I can create an API around and link it to php or python.
I'm comfortable with python, php, C, and shell. This is a personal project, so I'm not interested in commercial applications as I'm aware of their existence.
Any ideas?
|
How to get a Device Specific UID using Python in ASE on Android?
| 5,914,317 | 0 | 2 | 234 | 0 |
python,android,ase,android-scripting
|
The newer versions of ASE now include a function call to create these identifiers.
| 0 | 1 | 0 | 1 |
2010-04-13T20:38:00.000
| 1 | 1.2 | true | 2,633,029 | 0 | 0 | 1 | 1 |
I am working on am Android Scripting Environment (ASE) script in Python to replicate an iPhone app.
I need a device UID of some sort. My thoughts where a salted MD5 hash of the MAC address or device phone number, but I can't figure out how to access either of those using the Python APIs within ASE.
What can I do to create a UID in Python in ASE?
|
Multiple classes in a Python module
| 2,634,412 | 5 | 42 | 44,756 | 0 |
python
|
It is absolutely proper to do so. A module groups related functionality. If that functionality is implemented in several classes (e.g., Tree, Node, Leaf) then it is appropriate to place them together.
A module is more closely associated with a Java package than a Java class. You can also implement a module as a folder, named for the module, with an __init__.py file inside (so Python can identify the module as such; the __init__.py may also optionally include initialization code and lists of classes, functions, and sub-packages to export.)
| 0 | 0 | 0 | 0 |
2010-04-14T01:57:00.000
| 5 | 0.197375 | false | 2,634,394 | 1 | 0 | 1 | 2 |
I'm very new to Python (I'm coming from a JAVA background) and I'm wondering if anyone could help me with some of the Python standards. Is it a normal or "proper" practice to put multiple class in a module? I have been working with Django and started with the tutorials and they place their database model classes in the same module. Is this something that is normally done or should I stick with 1 class per module? Is there a reason I would do one over the other?
Hope I'm being clear and not to generic. Thanks to everyone in advance!
|
Multiple classes in a Python module
| 2,634,436 | 8 | 42 | 44,756 | 0 |
python
|
When in doubt, just look at Python's standard libraries :)
For example, the standard calendar module contains 31 classes. So yes, it is ok.
| 0 | 0 | 0 | 0 |
2010-04-14T01:57:00.000
| 5 | 1 | false | 2,634,394 | 1 | 0 | 1 | 2 |
I'm very new to Python (I'm coming from a JAVA background) and I'm wondering if anyone could help me with some of the Python standards. Is it a normal or "proper" practice to put multiple class in a module? I have been working with Django and started with the tutorials and they place their database model classes in the same module. Is this something that is normally done or should I stick with 1 class per module? Is there a reason I would do one over the other?
Hope I'm being clear and not to generic. Thanks to everyone in advance!
|
Django/Python: Save an HTML table to Excel
| 2,640,085 | 2 | 5 | 9,613 | 0 |
python,django,excel,html-table
|
Use CSV. There's a module in Python ("csv") to generate it, and excel can read it natively.
| 0 | 0 | 0 | 0 |
2010-04-14T18:40:00.000
| 3 | 0.132549 | false | 2,640,072 | 0 | 0 | 1 | 1 |
I have an HTML table that I'd like to be able to export to an Excel file. I already have an option to export the table into an IQY file, but I'd prefer something that didn't allow the user to refresh the data via Excel. I just want a feature that takes a snapshot of the table at the time the user clicks the link/button.
I'd prefer it if the feature was a link/button on the HTML page that allows the user to save the query results displayed in the table. It would also be nice if the formatting from the HTML/CSS could be retained. Is there a way to do this at all? Or, something I can modify with the IQY?
I can try to provide more details if needed. Thanks in advance.
|
A web framework where AJAX was not an after thought
| 2,642,409 | 0 | 8 | 495 | 0 |
php,.net,python,ajax,frameworks
|
Two approaches to this problem generally. One is for the framework to try and do it all, like Microsoft's ASP.NET with its Ajax toolkit. This includes server side controls that produce Ajax functionality with all client- and server-side code generated for you. For example, their UpdatePanel control allows for partial page updates via an Ajax call. However, it is not universally popular as a framework in general because their Page and Control models are sometimes seen as too heavyweight and overbloated.
A second, "slimmer" approach would be to separate the concerns. Let jQuery or a similar library deal with cross-browser inconsistencies and the client side of the Ajax call, and use a simple lightweight server-side web framework, such as Groovy on Grails or Microsoft ASP.NET MVC (there are others as I'm sure people will point out). Any decent framework should be capable of easily producing either JSON or XML data in response to an Ajax call.
As for browsers with Javascript disabled - this is the twenty first century. Do you really have to cater for them any more?
| 0 | 0 | 0 | 0 |
2010-04-15T02:24:00.000
| 4 | 0 | false | 2,642,364 | 0 | 0 | 1 | 1 |
AJAX is a pain in the ass because it essentially means you'll have to write two sets of similarish code: one for browsers with JavaScript enabled and those without.
Not only this, but you have to connect JavaScript events to hook into your models and display the results.
And if all that weren't bad enough, you need to send an address change with the request, otherwise the user won't be able to "click back" correctly (if confused look at what happens to the address bar when you click links in GMail).
We're searching for something that had the foresight and design goals with all these concerns in mind.
Performance and security are also obvious major concerns.
We love config-based systems as well, where you don't have to write a lot of code you just drop it into an easily read config format.
It's like asking for the holy grail right?
|
google app engine error ,and i can't open it now.(python)
| 34,367,657 | 0 | 6 | 6,342 | 0 |
python,google-app-engine
|
Not enough points to provide a comment on the answers above hence the stand alone answer. If you delete the ini files as per the other answers the pathways to your projects in the launcher will likely also be gone. In my case however I simply moved the ini files out of the C:\Users\your username\Google directory and then after opening and closing the launcher successfully once I reinstated the ini files into the Google directory again, after which the launcher worked and the project pathways were retained.
| 0 | 1 | 0 | 0 |
2010-04-15T06:03:00.000
| 5 | 0 | false | 2,643,081 | 0 | 0 | 1 | 3 |
the error is :
Errors occurred
See the logfile 'D:\Program Files\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe.log' for details
Why?
|
google app engine error ,and i can't open it now.(python)
| 31,897,510 | 3 | 6 | 6,342 | 0 |
python,google-app-engine
|
Solution:
Note: The wrong directories are stated above.
Go to C:\Users\your username\Google directory.
Delete google_appengine_launcher.ini and google_appengine_projects.ini
Appengine should now start successfully, absent error message.
| 0 | 1 | 0 | 0 |
2010-04-15T06:03:00.000
| 5 | 0.119427 | false | 2,643,081 | 0 | 0 | 1 | 3 |
the error is :
Errors occurred
See the logfile 'D:\Program Files\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe.log' for details
Why?
|
google app engine error ,and i can't open it now.(python)
| 17,596,077 | 2 | 6 | 6,342 | 0 |
python,google-app-engine
|
yeah just like RyanW mentioned the link, Delete the .ini files viz. google_appengine_launcher.ini & google_appengine_projects.ini in the user Directory in folder named Google.
| 0 | 1 | 0 | 0 |
2010-04-15T06:03:00.000
| 5 | 0.07983 | false | 2,643,081 | 0 | 0 | 1 | 3 |
the error is :
Errors occurred
See the logfile 'D:\Program Files\Google\google_appengine\launcher\GoogleAppEngineLauncher.exe.log' for details
Why?
|
Is there a production ready web application framework in Python?
| 2,643,669 | 15 | 14 | 5,358 | 0 |
python,web-applications
|
For the context, I work at a large private bank in Switzerland, writing Enterprise applications on the J2EE stack.
There are plenty of "Production Ready" web frameworks in Python. And there are plenty of large Python-based websites out there.
That said, I think Python is a poor choice for an Enterprisy application. It can be used as a glue language, or a scripting language (our deployment scripts are Python). The showstopper for me is backward compatibility (Python 3.x isn't backward compatible with Python 2.x). The Python philosopy seems to be more to innovate and make the language better, smoother, and not necessarily to support programs written 10 years ago.
On the Web framework side, I love Django, but it is definitely much too young and it evolves too rapidly to be used in the enterprise. I don't have much experience with other Python-based frameworks.
If you want an enterprise-oriented framework, you'll have to stay with enterprise stacks (Java / .Net).
On the other hand, even in the Java world, there is a tendency to use frameworks that are less enterprisy. Think Spring vs EJB2 or EJB3 being much lighter weight than EJB2. Or think Flex (which is far from an enterprise framework in my view) being used more and more in the enterprise. So if your enterprise is openminded enough, ready to jump into the future, using Django, RoR or other modern Web 2.0, community driven, Open Source, next generation, active record based frameworks ... might not be that much of a stretch ...
And finally, to answer a few of your points directly :
support of ORM / caching / ... : yes, but most solutions are based on active record, which is fine for 90% of what you might want to do, but is definitly not as complete / complex as JPA / Hibernate
control-oriented UI : no, and you wont find a standard, so you wont find 3rd party components. The closest you might get is integration with jQuery or other JS UI frameworks
dependency injection : There is a port of Spring to Python, maintained by SpringSource. But DI is not in the Python philosophy. The same problem will be resolved with functions, default arguments and closures. And we might argue that the Pythonic solution is cleaner than the Java way ...
unit / integration tests : very good support, multiple test frameworks. Still, support is not as good as Java where we have tons of tools around testing.
good IDE support : there are technical limitations to the ammount of support you can provide to a dynamic language, but at least both Eclipse and Netbeans have great support for Python.
clustering / modularity : clustering will be resolved with a "share nothing infrastructure" and/or distributed caching. There are no solutions for modularity (in the OSGI sense) as far as I know. But I would challenge that very often OSGI is a solution for a problem we dont have in the enterprise ...
| 0 | 0 | 0 | 0 |
2010-04-15T07:07:00.000
| 6 | 1.2 | true | 2,643,321 | 0 | 0 | 1 | 1 |
I heard lots of good opinions about Python language. They say it's mature, expressive etc... I'm looking for production-ready enterprise application frameworks in Python. By "production ready" I mean :
supports objective-relational mapping with caching and declarative desciption (like JPA, Hibernate etc..)
controls oriented user interface support - no HTML templates but something like JSF (RichFaces, Icefaces) or GWT, Vaadin, ZK
component decomposition and dependency injection (like EJB or Spring)
unit and integration testing
good IDE support
clustering, modularity etc (like Terracota, OSGi etc..)
there are successful applications written in it by companies like IBM, Oracle etc (I mean real business applications not Twitter)
could have commercial support
Is it possible at all in Python world ? Or only choices are :
use Python and write everything from the bottom (too expensice)
stick to Java EE
buy .NET stack
|
I can't login to my Django app when debug is set to False
| 2,645,668 | 0 | 2 | 1,621 | 0 |
python,django,apache,login,debugging
|
I would guess that this is related to errors in admin classes requiring the devserver to be restarted to continue.
As nothing is being reportedm I would try removing all of your admin.py definitions and just use the basic admin.site.register(SomeModel) for everything and seeing if it still happens, then add them back in until it re-occurs.
| 0 | 0 | 0 | 0 |
2010-04-15T08:23:00.000
| 5 | 0 | false | 2,643,721 | 0 | 0 | 1 | 4 |
Short Story: I get locked out of my Django app when Debug is set to False.
Long story:
Case 1 (the first time it happened):
I enter my login info, but It just redirects to the login page.
I restart the server, try to login, and it works fine, I get in.
a few hours later I come back, log out, try to log back in and I can't. It just redirects to the login page.
Case 2 (I figure out how to provoke the login failure):
I restart the server and am able to login to the site.
I log in and log out several times, everything is fine.
I go to a non-existing page and get a server error.
I log out and try to log back in, and I can't, just get redirected back to the login page.
Case 3 (I can't provoke the login failure with Debug set to True):
1. I restart the server and am able to login to the site.
2. I log in and log out several times, everything is fine.
3. I go to a non-existing page and get a traceback.
4. I log out and log back in, everything works.
5. I wait and play around with it and can't get the login to fail while in Debug mode.
Please help!
|
I can't login to my Django app when debug is set to False
| 2,644,182 | 1 | 2 | 1,621 | 0 |
python,django,apache,login,debugging
|
Do you have a custom 500 error handler set up? Is that doing something weird with the session, perhaps?
| 0 | 0 | 0 | 0 |
2010-04-15T08:23:00.000
| 5 | 0.039979 | false | 2,643,721 | 0 | 0 | 1 | 4 |
Short Story: I get locked out of my Django app when Debug is set to False.
Long story:
Case 1 (the first time it happened):
I enter my login info, but It just redirects to the login page.
I restart the server, try to login, and it works fine, I get in.
a few hours later I come back, log out, try to log back in and I can't. It just redirects to the login page.
Case 2 (I figure out how to provoke the login failure):
I restart the server and am able to login to the site.
I log in and log out several times, everything is fine.
I go to a non-existing page and get a server error.
I log out and try to log back in, and I can't, just get redirected back to the login page.
Case 3 (I can't provoke the login failure with Debug set to True):
1. I restart the server and am able to login to the site.
2. I log in and log out several times, everything is fine.
3. I go to a non-existing page and get a traceback.
4. I log out and log back in, everything works.
5. I wait and play around with it and can't get the login to fail while in Debug mode.
Please help!
|
I can't login to my Django app when debug is set to False
| 6,030,163 | 0 | 2 | 1,621 | 0 |
python,django,apache,login,debugging
|
Make sure the urls.py file imports everything from django.conf.urls.defaults.
You may have explicitly imported certain methods such as patterns and include (as I did to combat PyDev's 'wild import' warning messages).
As a result, crucial statements that assign Django's default handlers to 404 and 500 HTTP error codes will be omitted.
This is obviously undesired and leads to the odd behavior described in the question.
| 0 | 0 | 0 | 0 |
2010-04-15T08:23:00.000
| 5 | 0 | false | 2,643,721 | 0 | 0 | 1 | 4 |
Short Story: I get locked out of my Django app when Debug is set to False.
Long story:
Case 1 (the first time it happened):
I enter my login info, but It just redirects to the login page.
I restart the server, try to login, and it works fine, I get in.
a few hours later I come back, log out, try to log back in and I can't. It just redirects to the login page.
Case 2 (I figure out how to provoke the login failure):
I restart the server and am able to login to the site.
I log in and log out several times, everything is fine.
I go to a non-existing page and get a server error.
I log out and try to log back in, and I can't, just get redirected back to the login page.
Case 3 (I can't provoke the login failure with Debug set to True):
1. I restart the server and am able to login to the site.
2. I log in and log out several times, everything is fine.
3. I go to a non-existing page and get a traceback.
4. I log out and log back in, everything works.
5. I wait and play around with it and can't get the login to fail while in Debug mode.
Please help!
|
I can't login to my Django app when debug is set to False
| 57,435,530 | 1 | 2 | 1,621 | 0 |
python,django,apache,login,debugging
|
My problem was if I set SESSION_COOKIE_SECURE = True then I can't login in http mode.
I had to change it to SESSION_COOKIE_SECURE = False
Maybe you had this too?
| 0 | 0 | 0 | 0 |
2010-04-15T08:23:00.000
| 5 | 0.039979 | false | 2,643,721 | 0 | 0 | 1 | 4 |
Short Story: I get locked out of my Django app when Debug is set to False.
Long story:
Case 1 (the first time it happened):
I enter my login info, but It just redirects to the login page.
I restart the server, try to login, and it works fine, I get in.
a few hours later I come back, log out, try to log back in and I can't. It just redirects to the login page.
Case 2 (I figure out how to provoke the login failure):
I restart the server and am able to login to the site.
I log in and log out several times, everything is fine.
I go to a non-existing page and get a server error.
I log out and try to log back in, and I can't, just get redirected back to the login page.
Case 3 (I can't provoke the login failure with Debug set to True):
1. I restart the server and am able to login to the site.
2. I log in and log out several times, everything is fine.
3. I go to a non-existing page and get a traceback.
4. I log out and log back in, everything works.
5. I wait and play around with it and can't get the login to fail while in Debug mode.
Please help!
|
urllib2 to string
| 35,367,453 | 16 | 7 | 17,378 | 0 |
python,string,urllib2
|
In python3, it should be changed to urllib.request.openurl('http://www.example.com/').read().decode('utf-8').
| 0 | 0 | 1 | 0 |
2010-04-15T17:48:00.000
| 4 | 1 | false | 2,647,723 | 0 | 0 | 1 | 1 |
I'm using urllib2 to open a url. Now I need the html file as a string. How do I do this?
|
google app engine persistent globals
| 2,650,039 | 6 | 1 | 595 | 0 |
python,database,google-app-engine,global
|
The datastore is the only place you can have guaranteed-persistent data that are also modifiable. So you can have a single large object, or several smaller ones (with a name attribute and others), depending on your desired access patterns -- but live in the datastore it must. You can use memcache for faster cache that usually persists across queries, but any memcache entry could go away any time, so you'll always need it to be backed by the datastore (in particular, any change must go to the datastore, not just to memcache).
| 0 | 1 | 0 | 0 |
2010-04-16T01:21:00.000
| 1 | 1.2 | true | 2,650,014 | 0 | 0 | 1 | 1 |
I'm looking for a way to keep the equivalent of persistent global variables in app engine (python). What I'm doing is creating a global kind that I initialize once (i.e. when I reset all my database objects when I'm testing). I have things in there like global counters, or the next id to assign certain kinds I create.
Is this a decent way to do this sort of thing or is there generally another approach that is used?
|
Django, How authenticate user with first name and last name?
| 2,656,270 | 1 | 1 | 1,594 | 0 |
python,django,django-models,django-admin
|
I like the idea of not making users remember a username, but I think a better solution to that is to have their email address be their user name. Is it fair for you to assume in your specific application that no two users will have the same first and last name? If that's not a fair assumption, how will your system handle that?
| 0 | 0 | 0 | 0 |
2010-04-16T01:52:00.000
| 4 | 0.049958 | false | 2,650,106 | 0 | 0 | 1 | 2 |
i want to authenticate users using firstname and lastname
This is the code i am using
user = auth.authenticate(first_name=firstname,last_name=lastname,password=password)
it keep coming up with NoneType: None
i have checked the firstname and lastname plus password seen to be correct?
what i am doing wrong? thanks
|
Django, How authenticate user with first name and last name?
| 2,650,166 | 2 | 1 | 1,594 | 0 |
python,django,django-models,django-admin
|
Building a little from @T. Stone's idea. Why not have them register with their First and Last name and you just concatenate them together and use that as their username?. And everytime you have them login you setup your view to combine the two fields again and use that string.
You won't be able to use some of the auto forms they can produce for you but that's not a big deal. I'd just combine the two strings, lowercase them and slap that as the username and do the same for every login instance.
| 0 | 0 | 0 | 0 |
2010-04-16T01:52:00.000
| 4 | 0.099668 | false | 2,650,106 | 0 | 0 | 1 | 2 |
i want to authenticate users using firstname and lastname
This is the code i am using
user = auth.authenticate(first_name=firstname,last_name=lastname,password=password)
it keep coming up with NoneType: None
i have checked the firstname and lastname plus password seen to be correct?
what i am doing wrong? thanks
|
Self Authenticating Links in Django
| 2,650,293 | 0 | 3 | 1,274 | 0 |
python,django,authentication
|
To T. Stone's point, end users are notorious for passing links around -- ESPECIALLY those in an intraweb environment. Having something that authenticated the user automatically means that I can almost guarantee that you're going to have at least one person logged in as somebody else.
There are better ways, of course, to refresh a user's session from Cookie information, so you at least have a decent idea that they're a valid user attached to a valid browser and can feel SOMEwhat safer in that they aren't likely to hand their laptops about like they might with a link, but yes... to reiterate, what you're trying to do is a VERY bad idea if your app has more than 1 user.
| 0 | 0 | 0 | 0 |
2010-04-16T02:25:00.000
| 3 | 0 | false | 2,650,189 | 0 | 0 | 1 | 1 |
In my web app I would like to be able to email self-authenticating links to users. These links will contain a unique token (uuid). When they click the link the token being present in the query string will be enough to authenticate them and they won't have to enter their username and password.
What's the best way to do this?
|
MySQL to AppEngine
| 2,662,880 | 0 | 0 | 1,278 | 1 |
python,mysql,google-app-engine,bulk-load
|
If you're using Pentaho BI Server as your data source, why don't you consider using Pentaho Data Integration (ETL tool) to move the data over? At the very least PDI automate any movement of data between your data source and any AppEngine bulk loader tool (it can easily trigger any app with a shell step).
| 0 | 1 | 0 | 0 |
2010-04-16T03:57:00.000
| 3 | 0 | false | 2,650,499 | 0 | 0 | 1 | 1 |
I'm from Brazil and study at FATEC (college located in Brazil).
I'm trying to learn about AppEngine.
Now, I'm trying to load a large database from MySQL to AppEngine to perform some queries, but I don't know how i can do it. I did some testing with CSV files,but is there any way to perform the direct import from MySQL?
This database is from Pentaho BI Server (www.pentaho.com).
Thank you for your attention.
Regards,
Daniel Naito
|
Storing a list of objects in GAE
| 2,656,720 | 0 | 2 | 296 | 0 |
python,google-app-engine,google-cloud-datastore
|
If it's really just a list of tuples / two "columns", could you just use an alternating list and a ListProperty? This would be fine if the data had a consistent dimension, was small, and didn't require indexing.
e.g. To encode the example you gave in a list do:
# i forget if mixed types are allowed, but you get the idea.
["xyz", 123, "abc", 456, "hij", 678, "rer", 838]
| 0 | 0 | 0 | 0 |
2010-04-16T11:09:00.000
| 2 | 0 | false | 2,652,394 | 0 | 0 | 1 | 1 |
I need to store some data that looks a little like this:
xyz 123
abc 456
hij 678
rer 838
Now I would just store it as a traditional string and integer model, and put in the datastore. But the data changes regularly, and is ONLY relevant when looked at as a COLLECTION. So it needs to be store as either a list of lists, or a list of objects, both of which can't really be done without pickling as far as I know. Can anyone help? Even storing it as a text file may work :S
Edit: I was a litle vague on details it seems.
I am sampling some data from an external source (scraping via BeautifulSoup/http2lib if it matters). This data then needs to be stored, as a whole, since it will be plotted on a graph. The data changes (but not often - perhaps once a week). Since the dataset is so simple (literally what you see above, 1 string field, and 1 integer) I figured it's easier to store them as a list of lists, then actually store them in a model. I have a feeling I have skipped over an even easier solution by concentrating too much on the fact the data needs to be stored together as one large lump.
I will be storing 500+ of these bits of data as a group, at once.
|
Django - how to write users and profiles handling in best way?
| 2,657,984 | 0 | 3 | 2,938 | 0 |
python,django,profiles
|
Thank you all for your answers! I know that django dev documentation mentions user profiles, but does it very briefly (roughly few lines) and links to djangobook containing information about user profiles, but... to its first version, covering django 0.96. The second version of djangobook, covering django 1.0 (that is way closer to 1.2 than 0.96) no longer has that information anywhere, what makes me highly confused - has anything changed? Is there other, better, more secure way to handle users and their profiles? Therefore this question asked.
| 0 | 0 | 0 | 0 |
2010-04-16T16:43:00.000
| 4 | 0 | false | 2,654,689 | 0 | 0 | 1 | 1 |
I am writing simple site that requires users and profiles to be handled. The first initial thought is to use django's build in user handling, but then the user model is too narrow and does not contain fields that I need. The documentation mentions user profiles, but user profiles section has been removed from djangobook covering django 1.0 (ideally, the solution should work with django 1.2), and the Internet is full of different solutions, not making the choice easier (like user model inheritance, user profiles and django signals, and so on).
I would like to know, how to write this in good, modern, fast and secure way. Should I try to extend django builtin user model, or maybe should I create my own user model wide enough to keep all the information I need? Below you may find some specifications and expectations from the working solution:
users should be able to register and authenticate
every user should have profile (or model with all required fields)
users dont need django builtin admin panel, but they need to edit their profiles/models via simple web form
Please, let me know how do you solve those issues in your applications, and what is the best current way to handle users with django. Any links to articles/blogs or code examples are highly appreciated!
|
How can I implement "real time" messaging on Google AppEngine?
| 2,660,540 | 1 | 3 | 554 | 0 |
javascript,python,google-app-engine,comet
|
The App Engine roadmap has Comet support, otherwise you will have some difficulty achieving this.
| 0 | 1 | 0 | 0 |
2010-04-17T22:31:00.000
| 3 | 0.066568 | false | 2,660,316 | 0 | 0 | 1 | 1 |
I'm creating a web application on Google AppEngine where I want the user to be notified a quickly as possible after certain events occour. The problem is similar to say a chat server in that I need something happening on one connection (someone is writing a message in a chat room) to propagate to a number of other connections (other people in that chat room gets the message). To get speedy updates from the server to the client I'm planning on using long polling with XmlHttpRequest, hoping that AppEngine won't interfere other than possibly restriing the timeout. The real problem however is efficient notification between connections on AppEngine.
Is there any support for this type of cross connection notification on AppEngine that does not involve busy-waiting? The only tools I can think of to do this at all is either using the data storage (slow) or memcache (unreliable), and none of them would let me avoid busy-waiting.
Note: I know about XMPP support on AppEngine. It's related, but I want a browser based solution, sending messages to the users by XMPP is not an option.
|
Problems with South/Django: not recognizing the Django App
| 2,665,161 | 3 | 2 | 2,042 | 0 |
python,macos,migration,django-south
|
Am I doing something really stupid?
Well, let's start with the "is it plugged in" questions:
Is your project directory in your Python path?
Are you running python manage.py and not, say, python some/path/i/am/omitting/manage.py? (This is a great way to not have the project in the Python path.)
What is the output of ./manage.py syncdb? (I use ./manage.py instead of python manage.py just in case they refer to different pythons.)
| 0 | 0 | 0 | 0 |
2010-04-19T02:42:00.000
| 1 | 0.53705 | false | 2,664,942 | 0 | 0 | 1 | 1 |
I've got a Django project on my machine and when I try to use South to migrate the data schema, I get several odd errors. Example:
$ python manage.py convert_to_south thisLocator
/Library/Python/2.6/site-packages/registration/models.py:4: DeprecationWarning: the sha >module is deprecated; use the hashlib module instead
import sha
/Users/cm/code/thisLocator/../thisLocator/batches/models.py:6: DeprecationWarning: the md5 >module is deprecated; use hashlib instead
import md5
There is no enabled application matching 'thisLocator'.
I've followed the South documentation. Settings.py has it in the installed apps, I can run import south from the manage.py shell. Everyone else on my team is calling the app thisLocator.
Am I doing something really stupid?
|
In SqlAlchemy, how to ignore m2m relationship attributes when merge?
| 2,667,004 | 0 | 0 | 396 | 1 |
python,sqlalchemy
|
You'd better fix your code to avoid setting role.users for the item you are going to merge. But there is another way - setting cascade='none' for this relation. Then you lose an ability to save relationship from Role side, you'll have to save User with roles attribute set.
| 0 | 0 | 0 | 0 |
2010-04-19T05:01:00.000
| 1 | 1.2 | true | 2,665,253 | 0 | 0 | 1 | 1 |
There is a m2m relation in my models, User and Role.
I want to merge a role, but i DO NOT want this merge has any effect on user and role relation-ship. Unfortunately, for some complicate reason, role.users if not empty.
I tried to set role.users = None, but SA complains None is not a list.
At this moment, I use sqlalchemy.orm.attributes.del_attribute, but I don't know if it's provided for this purpose.
|
How Can I Store My Images On The Server
| 2,665,989 | 1 | 0 | 191 | 0 |
python,django,photo-upload
|
There are two common options.
1) Store them on the file system on the server, preferably not all in one directory - but split logically.
2) Store the images in a database, if you are using MySql you would do this using the "blob" type.
| 0 | 0 | 0 | 0 |
2010-04-19T07:52:00.000
| 2 | 0.099668 | false | 2,665,921 | 0 | 0 | 1 | 1 |
How do I store a photo on the server.
I store them in a directory - "D:\zjm_code\basic_project\pinax\media\default\pinax\images\upload" but this now a lot of images.
Is there another simple way?
Thanks
|
Pylons: question about websetup.py use
| 2,668,235 | 2 | 0 | 496 | 0 |
python,pylons,paster
|
Ok, I was wrong. The websetup is used by the setup script and before the test are executed.
A controller make an import for a test module, and then setup_app is called.
Thanks!.
| 0 | 0 | 0 | 0 |
2010-04-19T12:57:00.000
| 1 | 1.2 | true | 2,667,529 | 0 | 0 | 1 | 1 |
reading pylons documentations I did understand that websetup:setup_app is only called when the application is setup at first time by paster script. But, I found now, setup_app is call every time that application starts. Debugging the code, this behaviour seems right because in appinstall.setup_config the module is loaded (as PRJ.websetup) and as it have the setup_app attribute, the function is called.
Can you point me in the right direction?
|
Large Django application layout
| 2,670,177 | 33 | 26 | 10,378 | 0 |
python,django,conventions
|
The best way that I have found to go about this is to create applications and then a project to glue them together. Most of my projects have similar apps which are included in each. Emails, notes, action reminders, user auth, etc. My preferred layout is like so:
project/
settings.py
urls.py
views.py
...
apps/
emails/
urls.py
views.py
...
notes/
urls.py
views.py
...
...
apps:
Each of the "apps" stands on its own, and other than a settings.py, does not rely on the project itself (though it can rely on other apps). One of the apps, is the user authentication and management. It has all of the URLs for accomplishing its tasks in apps/auth/urls.py. All of its templates are in apps/auth/templates/auth/. All of its functionality is self-contained, so that when I need to tweak something, I know where to go.
project:
The project/ contains all of the glue required to put these individual apps together into the final project. In my case, I made use heavy of settings.INSTALLED_APPS in project/ to discern which views from the apps were available to me. This way, if I take apps.notes out of my INSTALLED_APPS, everything still works wonderfully, just with no notes.
Maintenance:
This layout/methodology/plan also has long-term positive ramifications. You can re-use any of the apps later on, with almost no work. You can test the system from the bottom up, ensuring that each of the apps works as intended before being integrated into the whole, helping you find/fix bugs quicker. You can implement a new feature without rolling it out to existing instances of the application (if it isn't in INSTALLED_APPS, they can't see it).
I'm sure there are better documented ways of laying out a project, and more widely used ways, but this is the one which has worked best for me so far.
| 0 | 0 | 0 | 0 |
2010-04-19T19:02:00.000
| 3 | 1.2 | true | 2,670,031 | 0 | 0 | 1 | 1 |
I am in a team developing a web-based university portal, which will be based on Django. We are still in the exploratory stages, and I am trying to find the best way to lay the project/development environment out.
My initial idea is to develop the system as a Django "app", which contains sub-applications to separate out the different parts of the system. The reason I intended to make these "sub" applications is that they would not have any use outside the parent application whatsoever, so there would be little point in distributing them separately. We envisage that the portal will be installed in multiple locations (at different universities, for example) so the main app can be dropped into a number of Django projects to install it. We therefore have a different repository for each location's project, which is really just a settings.py file defining the installed portal applications, and a urls.py routing the urls to it.
I have started to write some initial code, though, and I've come up against a problem. Some of the code that handles user authentication and profiles seems to be without a home. It doesn't conceptually belong in the portal application as it doesn't relate to the portal's functionality. It also, however, can't go in the project repository - as I would then be duplicating the code over each location's repository. If I then discovered a bug in this code, for example, I would have to manually replicate the fix over all of the location's project files.
My idea for a fix is to make all the project repos a fork of a "master" location project, so that I can pull any changes from that master. I think this is messy though, and it means that I have one more repository to look after.
I'm looking for a better way to achieve this project. Can anyone recommend a solution or a similar example I can take a look at? The problem seems to be that I am developing a Django project rather than just a Django application.
|
Web Security: Worst-Case Situation
| 2,670,489 | 1 | 3 | 263 | 0 |
python,security
|
Https is a must, but you also have to come to terms with the fact that no site can be 100% secure. The only other way for you to get a significant improvement in security is to have very short session timeouts and provide you users with hardware tokens, but even tokens can be stolen.
| 0 | 0 | 1 | 0 |
2010-04-19T19:49:00.000
| 4 | 0.049958 | false | 2,670,346 | 0 | 0 | 1 | 2 |
I currently have built a system that checks user IP, browser, and a random-string cookie to determine if he is an admin.
In the worst case, someone steals my cookie, uses the same browser I do, and masks his IP to appear as mine. Is there another layer of security I should add onto my script to make it more secure?
EDIT: To clarify: my website accepts absolutely NO input from users. I'm just designing a back-end admin panel to make it easier to update database entries.
|
Web Security: Worst-Case Situation
| 2,670,747 | 1 | 3 | 263 | 0 |
python,security
|
THe one thing I miss besides everything that is mentioned is fixing "all other security problems".
If you have a SQL injection, you're effort on the cookies is a waste of time.
If you have a XSRF vuln, you're effort on the cookies is a waste of time.
If you have XSS, ....
If you have HPP, ...
If you have ...., ....
You get the point.
If you really want to cover everything, I suggest you get the vulnerability landscape clear and build an attack tree (Bruce Schneier).
| 0 | 0 | 1 | 0 |
2010-04-19T19:49:00.000
| 4 | 0.049958 | false | 2,670,346 | 0 | 0 | 1 | 2 |
I currently have built a system that checks user IP, browser, and a random-string cookie to determine if he is an admin.
In the worst case, someone steals my cookie, uses the same browser I do, and masks his IP to appear as mine. Is there another layer of security I should add onto my script to make it more secure?
EDIT: To clarify: my website accepts absolutely NO input from users. I'm just designing a back-end admin panel to make it easier to update database entries.
|
Enforce unique upload file names using django?
| 43,329,765 | 9 | 66 | 39,098 | 0 |
python,django,pinax,file-rename
|
As of the writing of this answer it seems like you no longer need to do anything special to make this happen. If you set up a FileField with a static upload_to property, the Django storage system will automatically manage naming so that if a duplicate filename is uploaded, Django will randomly generate a new unique filename for the duplicate.
Works on Django 1.10.
| 0 | 0 | 0 | 0 |
2010-04-20T08:30:00.000
| 7 | 1 | false | 2,673,647 | 0 | 0 | 1 | 2 |
What's the best way to rename photos with a unique filename on the server as they are uploaded, using django? I want to make sure each name is used only once. Are there any pinax apps that can do this, perhaps with GUID?
|
Enforce unique upload file names using django?
| 57,465,077 | 0 | 66 | 39,098 | 0 |
python,django,pinax,file-rename
|
django enforce unique filename automatically.
if the file already exists, seven unique characters are appended to the filename
tested on django 2.2
| 0 | 0 | 0 | 0 |
2010-04-20T08:30:00.000
| 7 | 0 | false | 2,673,647 | 0 | 0 | 1 | 2 |
What's the best way to rename photos with a unique filename on the server as they are uploaded, using django? I want to make sure each name is used only once. Are there any pinax apps that can do this, perhaps with GUID?
|
Stealing Cookies with no user input?
| 2,676,818 | 1 | 1 | 1,146 | 0 |
python,security,xss
|
If there's no user input (no links to click that have any effects, etc.), how does the admin backend qualify as "dynamic"?
But basically: No, not unless you're using HTTPS. Even if you're not accepting input, the cookie is transmitted in plaintext and so can be captured (by a man-in-the-middle attack, etc.) and used. (I assume you don't want other people using the cookie to see the admin stuff.)
Or did I completely misunderstand the question? ;-)
| 0 | 0 | 0 | 0 |
2010-04-20T16:15:00.000
| 2 | 1.2 | true | 2,676,747 | 0 | 0 | 1 | 1 |
I'm creating a static site generator with a dynamic admin backend for one user. The site accepts no user input. Does this mean that I am safe from attackers who are trying to steal my admin cookie?
(there is no user input, so XSS and other methods don't work, right?)
|
Regex for finding valid sphinx fields
| 2,678,057 | 3 | 2 | 700 | 0 |
python,regex,django,sphinx
|
To match all allowed fields, the following rather fearful looking regex works:
@((?:cat|mouse|dog|puppy)\b|\((?:(?:cat|mouse|dog|puppy)(?:, *|(?=\))))+\))
It returns these matches, in order: @cat, @(cat), @(cat, dog), @cat, @dog, @(cat, dog), @mouse.
The regex breaks down as follows:
@ # the literal character "@"
( # match group 1
(?:cat|mouse|dog|puppy) # one of your valid search terms (not captured)
\b # a word boundary
| # or...
\( # a literal opening paren
(?: # non-capturing group
(?:cat|mouse|dog|puppy) # one of your valid search terms (not captured)
(?: # non-capturing group
, * # a comma "," plus any number of spaces
| # or...
(?=\)) # a position followed by a closing paren
) # end non-capture group
)+ # end non-capture group, repeat
\) # a literal closing paren
) # end match group one.
Now to identify any invalid search, you would wrap all that in a negative look-ahead:
@(?!(?:cat|mouse|dog|puppy)\b|\((?:(?:cat|mouse|dog|puppy)(?:, *|(?=\))))+\))
--^^
This would identify any @ character after which an invalid search term (or term combination) was attempted. Modifying it so that it also matches the invalid attempt instead of just pointing at it is not that hard anymore.
You would have to prepare (?:cat|mouse|dog|puppy) from your field dynamically and plug it into the static rest of the regex. Should not be too hard to do either.
| 0 | 0 | 0 | 0 |
2010-04-20T18:41:00.000
| 6 | 0.099668 | false | 2,677,713 | 1 | 0 | 1 | 1 |
I'm trying to validate that the fields given to sphinx are valid, but I'm having difficulty.
Imagine that valid fields are cat, mouse, dog, puppy.
Valid searches would then be:
@cat search terms
@(cat) search terms
@(cat, dog) search term
@cat searchterm1 @dog searchterm2
@(cat, dog) searchterm1 @mouse searchterm2
So, I want to use a regular expression to find terms such as cat, dog, mouse in the above examples, and check them against a list of valid terms.
Thus, a query such as:
@(goat)
Would produce an error because goat is not a valid term.
I've gotten so that I can find simple queries such as @cat with this regex: (?:@)([^( ]*)
But I can't figure out how to find the rest.
I'm using python & django, for what that's worth.
|
How to create simple web site with Python?
| 2,684,119 | 3 | 22 | 60,467 | 0 |
python,html,web-applications
|
Why don't you try out the Google AppEngine stuff? They give you a local environment (that runs on your local system) for developing the application. They have nice, easy intro material for getting the site up and running - your "hello, world" example will be trivial to implement.
From there on, you can either go with some other framework (using what you have learnt, as the vanilla AppEngine stuff is pretty standard for simple python web frameworks) or carry on with the other stuff Google provides (like hosting your app for you...)
| 0 | 0 | 1 | 0 |
2010-04-21T09:40:00.000
| 6 | 1.2 | true | 2,681,754 | 0 | 0 | 1 | 1 |
How to create simple web site with Python?
I mean really simple, f.ex, you see text "Hello World", and there are button "submit", which onClick will show AJAX box "submit successful".
I want to start develop some stuff with Python, and I don't know where to start.
|
Can PyAMF support service deployment by way of the filesystem?
| 2,684,503 | 0 | 2 | 296 | 0 |
python,django,mod-wsgi,cherrypy,pyamf
|
I use PyAMF together with Django. A possible solution could roughly look like this:
Create a python module containing all your different AMF services py files
Create a view that wrapps the DjangoGateway and initialize all your services. Inside this view you could do the following:
reload() your service module
populate a dictionary based on i.e. the file names ({SERVICE_NAME: SERVICE_INSTANCE})
Instantiate DjangoGateway with this dictionary and let it handle the incoming request.
This is a hackish solution based on the fact that you can only deploy files without any additional actions like restarting a server.
| 0 | 0 | 0 | 0 |
2010-04-21T14:43:00.000
| 2 | 0 | false | 2,683,946 | 0 | 0 | 1 | 1 |
I'm evaluating PyAMF to replace our current PHP (ugh) AMF services framework, and I'm unable to find the one crucial piece of information that would allow me to provide a compelling use case for changing over:
Right now, new PHP AMF services are deployed simply by putting the .php files in the filesystem; the next time they're accessed, the new service is in play. Removal of a service is as simple as deleting the .php file that provided it, and updating it is correspondingly simple. I need that same ease-of-deployment from PyAMF. If we have to rewrite our installers to deploy these services, it'll be a nonstarter.
So, what I need to know is, can PyAMF support new service discovery by way of the filesystem, can it support service upgrading and removal by way of same, and if so, what is the best way to set it up to do this?
I'm open to any of the various server options; I can easily have cherrypy, django, whatever installed and running on its own, and even -- with a bit more sturm nd drang -- have mod_python or mod_wsgi made available.
|
CherryPy and concurrency
| 37,571,640 | 0 | 2 | 15,864 | 0 |
python,concurrency,wsgi,cherrypy
|
Your client needs to actually READ the server's response. Otherwise the socket/thread will stay open/running until timeout and garbage collected.
use a client that behaves correctly and you'll see that your server will behave too.
| 0 | 0 | 0 | 0 |
2010-04-21T17:20:00.000
| 3 | 0 | false | 2,685,089 | 1 | 0 | 1 | 1 |
I'm using CherryPy in order to serve a python application through WSGI.
I tried benchmarking it, but it seems as if CherryPy can only handle exactly 10 req/sec. No matter what I do.
Built a simple app with a 3 second pause, in order to accurately determine what is going on... and I can confirm that the 10 req/sec has nothing to do with the resources used by the python script.
__
Any ideas?
|
How to add a Facebook Event with new Graph API
| 2,736,115 | 2 | 5 | 12,520 | 0 |
python,django,facebook,facebook-graph-api
|
If you require access to user data while the user is not online, there is the offline_access extended privilege which gives you a longer lived session key. This can be used to perform updates while the user is offline.
While I can't help you with Django, most of the Graph API does seem to work for me (not tried events unfortunately) but just seems badly documented.
| 0 | 0 | 0 | 0 |
2010-04-22T13:03:00.000
| 4 | 0.099668 | false | 2,690,971 | 0 | 0 | 1 | 1 |
I am trying to create an event using Facebooks api. (From a django app) Has anyone created an event with the new graph api?
|
On App Engine, what does optimization for reads mean?
| 2,694,726 | 0 | 1 | 115 | 0 |
python,google-app-engine
|
"Optimize for reads, not writes" means that you should expect to see far more reads than writes, and so you should strive to make it as easy as possible to read your data, even if that might slow down the writes a little. Easy for the computer, that is, meaning that for example if you want to show names in all lowercase, you should lowercase them when they're written to the database rather than lowercasing them everytime you read them from the database. That's just an example but hopefully it makes things clear.
| 0 | 1 | 0 | 0 |
2010-04-22T21:11:00.000
| 3 | 0 | false | 2,694,542 | 0 | 0 | 1 | 2 |
In the documentation for Google App Engine, it says that when designing data models for the datastore, you should "optimize for reads, not writes". What exactly does this mean? What is more 'expensive', CPU intensive or time consuming?
|
On App Engine, what does optimization for reads mean?
| 2,695,382 | 0 | 1 | 115 | 0 |
python,google-app-engine
|
agreed with @redtuna (expecting more reads than writes) and @Ilian Iliev (reads cheaper than writes & writes take more resources). another way you can optimize for reads is by using the Memcache service. since reads (usually) happen more often than writes, caching that data means that you don't even have to take a hit of a datastore access. also, items that stay active (see fetches/hits) stay in the cache longer as it employs an LRU strategy.
| 0 | 1 | 0 | 0 |
2010-04-22T21:11:00.000
| 3 | 0 | false | 2,694,542 | 0 | 0 | 1 | 2 |
In the documentation for Google App Engine, it says that when designing data models for the datastore, you should "optimize for reads, not writes". What exactly does this mean? What is more 'expensive', CPU intensive or time consuming?
|
Django ORM and multiprocessing
| 2,707,816 | 0 | 1 | 1,276 | 0 |
python,django,django-models,message-queue,multiprocessing
|
It's a little hard to say without more information, but the problem is probably caused by having an open database connection as you spawn new processes, and then trying to use that database connection in the separate processes. Don't re-use database connections from the parent process in multiprocessing workers you spawn; always recreate database connections.
| 0 | 0 | 0 | 0 |
2010-04-25T09:59:00.000
| 1 | 0 | false | 2,707,811 | 0 | 0 | 1 | 1 |
I am using Django ORM in my python script in a decoupled fashion i.e. it's not running in context of a normal Django Project.
I am also using the multi processing module. And different process in turn are making queries.
The process ran successfully for an hr and exited with this message
"IOError: [Errno 32] Broken pipe"
Upon futhur diagnosis and debugging this error pops up when I call save() on the model instance.
I am wondering
Is Django ORM Process save ?
Why would this error arise else ?
Cheers
Ankur
Found the Answer I was calling a return after starting the process. This error sneaked in as i did a small cut and paste of a function.
|
Python script repeated auto start up
| 2,708,720 | 3 | 1 | 168 | 0 |
python,email
|
Is it possible to have a setup, where
the script starts up automatically at
a give time, say 1 pm everyday, sends
out the email and then quits?
It's surely possible in general, but it entirely depends on what your shared web hosting provider is offering you. For these purposes, you'd use some kind of cron in any version or variant of Unix, Google App Engine, and so on. But since you tell us nothing about your provider and what services it offers you, we can't guess whether it makes such functionality available at all, or in what form.
(Incidentally: this isn't really a programming question, so, if you want to post more details and get help, you might have better luck at serverfault.com, the companion site to stackoverflow.com that deals with system administration questions).
| 0 | 0 | 0 | 1 |
2010-04-25T15:15:00.000
| 1 | 1.2 | true | 2,708,705 | 0 | 0 | 1 | 1 |
I am designing a python web app, where people can have an email sent to them on a particular day. So a user puts in his emai and date in a form and it gets stored in my database.
My script would then search through the database looking for all records of todays date, retrive the email, sends them out and deletes the entry from the table.
Is it possible to have a setup, where the script starts up automatically at a give time, say 1 pm everyday, sends out the email and then quits? If I have a continuously running script, i might go over the CPU limit of my shared web hosting. Or is the effect negligible?
Ali
|
Javascript (and HTML rendering) engine without a GUI for automation?
| 3,593,127 | 0 | 4 | 7,009 | 0 |
javascript,python,automation,rendering,mechanize
|
Try HtmlUnit !!!
| 0 | 0 | 0 | 0 |
2010-04-26T19:26:00.000
| 7 | 0 | false | 2,716,230 | 0 | 0 | 1 | 1 |
Are there any libraries or frameworks that provide the functionality of a browser, but do not need to actually render physically onto the screen?
I want to automate navigation on web pages (Mechanize does this, for example), but I want the full browser experience, including Javascript. Thus, I'd like to have a virtual browser of some sort, that I can use to "click on links" programmatically, have DOM elements and JS scripts render within it, and manipulate these elements.
Solution preferably in Python, but I can manage others.
|
Can python code (say if I used djangno) be obfuscated to the same 'level' as c#/java?
| 2,724,925 | 0 | 0 | 293 | 0 |
c#,java,python,obfuscation
|
Python code gets compiled to bytecode (.pyc) files as it is imported. You can distribute those .pyc files instead of the .py source code files, and the Python interpreter should be able to load them. While Python bytecode is more "obfuscated" than Python source code, it's still relatively easy to disassemble Python bytecode -- but, then again, it's not that hard to disassemble Java bytecode, either.
| 0 | 0 | 0 | 1 |
2010-04-27T20:34:00.000
| 4 | 0 | false | 2,724,885 | 1 | 0 | 1 | 2 |
If I obfuscated python code, would it provide the same level of 'security' as c#/java obfuscating?
i.e it makes things a little hard, but really you can still reverse engineer if you really wanted to, its just a bit cryptic.
|
Can python code (say if I used djangno) be obfuscated to the same 'level' as c#/java?
| 2,725,016 | 0 | 0 | 293 | 0 |
c#,java,python,obfuscation
|
Obfuscation doesn't provide security. What you describe isn't security.
If you distribute your Python program or your Java program or your C program, it is vunerable. What protects you from people using what you distributed unfairly is the law and people not being jerks.
Obfuscation not only provides no security, it has the potential of breaking working code, hurting performance, and ruining documentation.
| 0 | 0 | 0 | 1 |
2010-04-27T20:34:00.000
| 4 | 0 | false | 2,724,885 | 1 | 0 | 1 | 2 |
If I obfuscated python code, would it provide the same level of 'security' as c#/java obfuscating?
i.e it makes things a little hard, but really you can still reverse engineer if you really wanted to, its just a bit cryptic.
|
Automatic logout in python web app
| 2,731,905 | 1 | 1 | 646 | 0 |
python,mysql,logging,web-applications
|
You can encode the expiration time as part of your session id.
Then when you validate the session id, you can also check if it has expired, and if so force the user to log-in again.
You can also clean your database periodically, removing expired sessions.
| 0 | 0 | 0 | 0 |
2010-04-28T17:44:00.000
| 2 | 0.099668 | false | 2,731,871 | 0 | 0 | 1 | 1 |
I have a web application in python wherein the user submits their email and password. These values are compared to values stored in a mysql database. If successful, the script generates a session id, stores it next to the email in the database and sets a cookie with the session id, with allows the user to interact with other parts of the sight.
When the user clicks logout, the script erases the session id from the database and deletes the cookie. The cookie expires after 5 hours. My concern is that if the user doesnt log out, and the cookie expires, the script will force him to login, but if he has copied the session id from before, it can still be validated.
How do i automatically delete the session id from the mysql database after 5 hours?
|
Is there anyway to get pdb and Mac Terminal to play nicely?
| 2,745,035 | 8 | 9 | 1,601 | 0 |
python,django,macos,terminal,pdb
|
OK - this works for me I created a ~/.pdbrc and added
import os
os.system("stty sane")
Now each time pdb is run it sets the line settings back to sane.
If I fall out to the terminal then I still have to do it manually - but it solves having to quit runserver and reset all the time.
| 0 | 1 | 0 | 0 |
2010-04-29T08:34:00.000
| 3 | 1.2 | true | 2,735,828 | 0 | 0 | 1 | 2 |
When debugging my django apps I use pdb for interactive debugging with pdb.set_trace().
However, when I amend a file the local django webserver restarts and then I cant see what I type in the terminal, until I type reset.
Is there anyway for this to happen automatically? It can be real annoying, having to cancel the runserver and reset and restart it all the time. I'm told it doesn't happen on other OS's (ubuntu) so is there anyway to make it not happen on the Mac? (I'm using Snow Leopard).
|
Is there anyway to get pdb and Mac Terminal to play nicely?
| 2,743,003 | 1 | 9 | 1,601 | 0 |
python,django,macos,terminal,pdb
|
The best I've found is doing a reset inside pdb like so:
import os; os.system("reset");
| 0 | 1 | 0 | 0 |
2010-04-29T08:34:00.000
| 3 | 0.066568 | false | 2,735,828 | 0 | 0 | 1 | 2 |
When debugging my django apps I use pdb for interactive debugging with pdb.set_trace().
However, when I amend a file the local django webserver restarts and then I cant see what I type in the terminal, until I type reset.
Is there anyway for this to happen automatically? It can be real annoying, having to cancel the runserver and reset and restart it all the time. I'm told it doesn't happen on other OS's (ubuntu) so is there anyway to make it not happen on the Mac? (I'm using Snow Leopard).
|
How to get debugging of an App Engine application working?
| 2,735,992 | 1 | 3 | 865 | 0 |
python,eclipse,debugging,google-app-engine,pydev
|
In fact setting a breakpoint in eclipse is very easy. You have two options:
In the grey area next to your line numbers, doubleclick or right mouseclick -> toggle breakpoint.
| 0 | 1 | 0 | 0 |
2010-04-29T09:00:00.000
| 1 | 1.2 | true | 2,735,968 | 0 | 0 | 1 | 1 |
I've got 10+ years in C/C++, and it appears Visual Studio has spoilt me during that time. In Visual Studio, debbuging issimple: I just add a breakpoint to a line of code, and as soon as that code is executed, my breakpoint triggers, at which point I can view a callstack, local/member variables, etc.
I'm trying to achieve this functionality under App Engine. I assume that is possible?
All the searching I've done to this point has led me to using Pydev in Eclipse. As best I can tell, I am successfully launching my simple 'hello world' program in Debug mode.
But the IDE doesn't even seem to have an option to set a breakpoint? I must be missing something.
I've googled long and hard about this, but am having no luck. Most results trace back to the same old threads that don't deal directly with my issue.
Can anyone shed some light on how you get basic debugging setup using Pydev/Eclipse with App Engine?
Alternatively, if there's an easier way to debug App Engine than using Pydev/Eclipse, I'd love to hear about it.
Thanks in advance.
|
A simple Python deployment problem - a whole world of pain
| 2,743,196 | 2 | 20 | 5,069 | 0 |
python,linux,deployment,pylons
|
Have a look at Buildout for reproducible deployments.
| 0 | 1 | 0 | 0 |
2010-04-29T23:55:00.000
| 8 | 0.049958 | false | 2,741,507 | 0 | 0 | 1 | 2 |
We have several Python 2.6 applications running on Linux. Some of them are Pylons web applications, others are simply long-running processes that we run from the command line using nohup. We're also using virtualenv, both in development and in production. What is the best way to deploy these applications to a production server?
In development we simply get the source tree into any directory, set up a virtualenv and run - easy enough. We could do the same in production and perhaps that really is the most practical solution, but it just feels a bit wrong to run svn update in production. We've also tried fab, but it just never works first time. For every application something else goes wrong. It strikes me that the whole process is just too hard, given that what we're trying to achieve is fundamentally very simple. Here's what we want from a deployment process.
We should be able to run one simple command to deploy an updated version of an application. (If the initial deployment involves a bit of extra complexity that's fine.)
When we run this command it should copy certain files, either out of a Subversion repository or out of a local working copy, to a specified "environment" on the server, which probably means a different virtualenv. We have both staging and production version of the applications on the same server, so they need to somehow be kept separate. If it installs into site-packages, that's fine too, as long as it works.
We have some configuration files on the server that should be preserved (ie. not overwritten or deleted by the deployment process).
Some of these applications import modules from other applications, so they need to be able to reference each other as packages somehow. This is the part we've had the most trouble with! I don't care whether it works via relative imports, site-packages or whatever, as long as it works reliably in both development and production.
Ideally the deployment process should automatically install external packages that our applications depend on (eg. psycopg2).
That's really it! How hard can it be?
|
A simple Python deployment problem - a whole world of pain
| 2,805,604 | 0 | 20 | 5,069 | 0 |
python,linux,deployment,pylons
|
I would use rsync to synchronize outwards from your production "prime" server to the others, and from your "beta test" platform, to your production "prime" server.
rsync has the benefit of copying only those files which changed, and copying only parts of files that changed partially, and verifying the integrity and identical content at the end on all machines. An update that gets part way through and is interrupted can easily be continued later, making your deployment more robust.
Subversion or Mercurial would not be a bad idea in this case either. Mercurial has the
advantage of allowing you to "pull" or "push" instead of just updating from one central source. You might find interesting cases where a decentralized model (mercurial) works better.
| 0 | 1 | 0 | 0 |
2010-04-29T23:55:00.000
| 8 | 0 | false | 2,741,507 | 0 | 0 | 1 | 2 |
We have several Python 2.6 applications running on Linux. Some of them are Pylons web applications, others are simply long-running processes that we run from the command line using nohup. We're also using virtualenv, both in development and in production. What is the best way to deploy these applications to a production server?
In development we simply get the source tree into any directory, set up a virtualenv and run - easy enough. We could do the same in production and perhaps that really is the most practical solution, but it just feels a bit wrong to run svn update in production. We've also tried fab, but it just never works first time. For every application something else goes wrong. It strikes me that the whole process is just too hard, given that what we're trying to achieve is fundamentally very simple. Here's what we want from a deployment process.
We should be able to run one simple command to deploy an updated version of an application. (If the initial deployment involves a bit of extra complexity that's fine.)
When we run this command it should copy certain files, either out of a Subversion repository or out of a local working copy, to a specified "environment" on the server, which probably means a different virtualenv. We have both staging and production version of the applications on the same server, so they need to somehow be kept separate. If it installs into site-packages, that's fine too, as long as it works.
We have some configuration files on the server that should be preserved (ie. not overwritten or deleted by the deployment process).
Some of these applications import modules from other applications, so they need to be able to reference each other as packages somehow. This is the part we've had the most trouble with! I don't care whether it works via relative imports, site-packages or whatever, as long as it works reliably in both development and production.
Ideally the deployment process should automatically install external packages that our applications depend on (eg. psycopg2).
That's really it! How hard can it be?
|
Url for the current page from a Mako template in Pylons
| 2,742,016 | 4 | 1 | 2,612 | 0 |
python,templates,pylons,mako
|
Not sure if this is the Pylons way of doing things but ${request.url} seems to work for me.
| 0 | 0 | 0 | 0 |
2010-04-30T02:05:00.000
| 2 | 1.2 | true | 2,741,893 | 0 | 0 | 1 | 1 |
I need to know the full url for the current page from within a Mako template file in Pylons.
The url will be using in an iframe contained within the page so it needs to be known when the page is being generated rather than after the page hits the server or from the environment. (Not sure if I am communicating that last bit properly)
|
Change text_factory in Django/sqlite
| 64,263,492 | 0 | 6 | 4,701 | 1 |
python,django,sqlite,pysqlite
|
Incompatible Django version. Check Django version for solving this error first. I was running on Django==3.0.8 and it was producing an error. Than I ran virtualenv where I have Django==3.1.2 and the error was removed.
| 0 | 0 | 0 | 0 |
2010-04-30T13:00:00.000
| 6 | 0 | false | 2,744,632 | 0 | 0 | 1 | 1 |
I have a django project that uses a sqlite database that can be written to by an external tool. The text is supposed to be UTF-8, but in some cases there will be errors in the encoding. The text is from an external source, so I cannot control the encoding. Yes, I know that I could write a "wrapping layer" between the external source and the database, but I prefer not having to do this, especially since the database already contains a lot of "bad" data.
The solution in sqlite is to change the text_factory to something like:
lambda x: unicode(x, "utf-8", "ignore")
However, I don't know how to tell the Django model driver this.
The exception I get is:
'Could not decode to UTF-8 column 'Text' with text'
in
/var/lib/python-support/python2.5/django/db/backends/sqlite3/base.py in execute
Somehow I need to tell the sqlite driver not to try to decode the text as UTF-8 (at least not using the standard algorithm, but it needs to use my fail-safe variant).
|
Is www.example.com/post/21/edit a RESTful URI? I think I know the answer, but have another question
| 2,750,368 | 2 | 4 | 267 | 0 |
python,rest,web.py
|
Instead of calling it /post/52/edit, what if you called it /post/52/editor?
Now it is a resource. Dilemma averted.
| 0 | 0 | 1 | 1 |
2010-05-01T14:43:00.000
| 4 | 0.099668 | false | 2,750,341 | 0 | 0 | 1 | 2 |
I'm almost afraid to post this question, there has to be an obvious answer I've overlooked, but here I go:
Context: I am creating a blog for educational purposes (want to learn python and web.py). I've decided that my blog have posts, so I've created a Post class. I've also decided that posts can be created, read, updated, or deleted (so CRUD). So in my Post class, I've created methods that respond to POST, GET, PUT, and DELETE HTTP methods). So far so good.
The current problem I'm having is a conceptual one, I know that sending a PUT HTTP message (with an edited Post) to, e.g., /post/52 should update post with id 52 with the body contents of the HTTP message.
What I do not know is how to conceptually correctly serve the (HTML) edit page.
Will doing it like this: /post/52/edit violate the idea of URI, as 'edit' is not a resource, but an action?
On the other side though, could it be considered a resource since all that URI will respond to is a GET method, that will only return an HTML page?
So my ultimate question is this: How do I serve an HTML page intended for user editing in a RESTful manner?
|
Is www.example.com/post/21/edit a RESTful URI? I think I know the answer, but have another question
| 2,750,379 | 4 | 4 | 267 | 0 |
python,rest,web.py
|
Another RESTful approach is to use the query string for modifiers: /post/52?edit=1
Also, don't get too hung up on the purity of the REST model. If your app doesn't fit neatly into the model, break the rules.
| 0 | 0 | 1 | 1 |
2010-05-01T14:43:00.000
| 4 | 0.197375 | false | 2,750,341 | 0 | 0 | 1 | 2 |
I'm almost afraid to post this question, there has to be an obvious answer I've overlooked, but here I go:
Context: I am creating a blog for educational purposes (want to learn python and web.py). I've decided that my blog have posts, so I've created a Post class. I've also decided that posts can be created, read, updated, or deleted (so CRUD). So in my Post class, I've created methods that respond to POST, GET, PUT, and DELETE HTTP methods). So far so good.
The current problem I'm having is a conceptual one, I know that sending a PUT HTTP message (with an edited Post) to, e.g., /post/52 should update post with id 52 with the body contents of the HTTP message.
What I do not know is how to conceptually correctly serve the (HTML) edit page.
Will doing it like this: /post/52/edit violate the idea of URI, as 'edit' is not a resource, but an action?
On the other side though, could it be considered a resource since all that URI will respond to is a GET method, that will only return an HTML page?
So my ultimate question is this: How do I serve an HTML page intended for user editing in a RESTful manner?
|
Google App Engine Python Unit Tests
| 4,059,206 | 1 | 17 | 5,767 | 0 |
python,unit-testing,google-app-engine
|
Since, gae is based on webhooks it can be easy to set your own testing framework for all relevant urls in your app.yaml. You can test it on sample dataset on development server ( start devel server with --datastore_path option ) and assert writes to database or webhook responses.
| 0 | 1 | 0 | 1 |
2010-05-01T17:32:00.000
| 4 | 0.049958 | false | 2,750,911 | 0 | 0 | 1 | 1 |
I'd like to write some Python unit tests for my Google App Engine. How can I set that up? Does someone happen to have some sample code which shows how to write a simple test?
|
Validity of GUI design patterns under linux
| 2,751,881 | 2 | 0 | 894 | 0 |
python,ruby,linux,design-patterns,mvvm
|
Given how you explain your application in a comment, while fully endorsing Qt, I would also recommend you consider the many advantages that could come your way from making your application a web app.
Since you say it's a client-server app, it needs (at least) local network connectivity at least, so the first objection typically raised against web apps is nullified.
The first huge advantage is that you wouldn't be choosing one client platform vs another -- just support modern cross-platform browsers like Firefox or Google's Chrome, and your customers will be able to pick whatever client platform(s) they prefer (if you also carefully check your app on Safari, which has much rendering logic in common with Chrome via the Webkit framework, your web app will then be usable on iPad too).
The second big win is that your app won't require any "installation" on the client(s) -- it will always be ready.
Modern Javascript frameworks (such as jQuery, Dojo, Closure, ...) allow heavy interactivity if you need it, support GUI building with UI widgets &c, and incidentally take care of most cross-browser differences on your behalf. On the server side, with either Ruby or Python (or other languages yet), you can even find frameworks that smoothly integrate with the client-side Javascript resources.
Oh, and, the computational resources needed to run the application (such as RAM, CPU power, disk space, ...) are cheaper "in bulk" on a server, or small group of servers, and thus shared among those clients which are active at a given time, than spread out over many clients (including many who won't happen to be active at any givem time;-).
Really, in my opinion, there is little left today to recommend local GUI apps when you're developing anew anyway, save possibly the need to run when cut off from all connectivity (and, even there, with HTML5 and the like, browsers are making great strides towards empowering such apps).
| 0 | 1 | 0 | 0 |
2010-05-01T21:11:00.000
| 5 | 0.07983 | false | 2,751,548 | 0 | 0 | 1 | 3 |
I am investigating a switch from windows to linux and i struggle to find samples of design patterns applied in this world.
The application is a classic client server with detailed forms for each business entity.
It will be taking user input, do some validation checks, a few calculations, and save them to database.
It will also have lists summarizing entities, and searches among these entities.
A click to one item of these lists will open the detailled forms.
If i use python or ruby, what should i use for GUI ?
And what pattern : is MVC, MVVM or MVP any good ?
Or is there anything better ?
Note : I have never done web developpement, and i would like to avoid to have to learn both linux and web developpement at the same time.
|
Validity of GUI design patterns under linux
| 2,751,596 | 1 | 0 | 894 | 0 |
python,ruby,linux,design-patterns,mvvm
|
The two main UI toolkits in Linux these days are Qt and GTK+. Qt is widely used by the KDE desktop, while GTK+ is widely used by Gnome. But a Qt app will run in Gnome and vise-versa. Both toolkits have bindings to a massive amount of languages.
| 0 | 1 | 0 | 0 |
2010-05-01T21:11:00.000
| 5 | 0.039979 | false | 2,751,548 | 0 | 0 | 1 | 3 |
I am investigating a switch from windows to linux and i struggle to find samples of design patterns applied in this world.
The application is a classic client server with detailed forms for each business entity.
It will be taking user input, do some validation checks, a few calculations, and save them to database.
It will also have lists summarizing entities, and searches among these entities.
A click to one item of these lists will open the detailled forms.
If i use python or ruby, what should i use for GUI ?
And what pattern : is MVC, MVVM or MVP any good ?
Or is there anything better ?
Note : I have never done web developpement, and i would like to avoid to have to learn both linux and web developpement at the same time.
|
Validity of GUI design patterns under linux
| 2,753,393 | 0 | 0 | 894 | 0 |
python,ruby,linux,design-patterns,mvvm
|
Design (or architectural) patterns have nothing to do with the target programming language or operating system. Ook at you problem, if you can see you requirements which will be fulfilled by some solution provided by a pattern and the consequences will be good, jsut use the pattern. If you aks MVC, MVP, MVVM etc. look at those patterns and problems they solve and if it is what you need for you application, use them.
| 0 | 1 | 0 | 0 |
2010-05-01T21:11:00.000
| 5 | 0 | false | 2,751,548 | 0 | 0 | 1 | 3 |
I am investigating a switch from windows to linux and i struggle to find samples of design patterns applied in this world.
The application is a classic client server with detailed forms for each business entity.
It will be taking user input, do some validation checks, a few calculations, and save them to database.
It will also have lists summarizing entities, and searches among these entities.
A click to one item of these lists will open the detailled forms.
If i use python or ruby, what should i use for GUI ?
And what pattern : is MVC, MVVM or MVP any good ?
Or is there anything better ?
Note : I have never done web developpement, and i would like to avoid to have to learn both linux and web developpement at the same time.
|
Appengine (python) returns empty for valid queries
| 2,752,566 | 0 | 2 | 161 | 0 |
python,google-app-engine
|
When this has happened to me it's because I've been using a TextField, which cannot be queried (but confusingly just gets ignored). Try switching to StringField.
| 0 | 1 | 0 | 0 |
2010-05-02T00:10:00.000
| 1 | 0 | false | 2,752,008 | 0 | 0 | 1 | 1 |
EDIT: Figured it out. For whatever reason the field in the index was called strWord instead of wordStr. I didn't notice because of the similarities. The file was auto generated, so I must have called the field that in a previous development version.
I've got an app with around half a million 'records', each of which only stores three fields. I'd like to look up records by a string field with a query, but I'm running into problems. If I visit the console page, manually view a record and save it (without making changes) it shows up in a query:
SELECT * FROM wordEntry WHERE wordStr = 'SomeString'
If I don't do this, I get 'no results'. Does appengine need time to update? If so, how much?
(I was also having trouble batch deleting and modifying data, but I was able to break the problem up into smaller chunks.)
|
Google App Engine - Document Editor Creation/Tap Into Google Docs?
| 2,758,807 | 2 | 1 | 655 | 0 |
python,ajax,google-app-engine,tinymce,text-editor
|
It sounds to me like you want to use the Google Docs editor like a widget within your application. To the best of my knowledge you can't do this.
| 0 | 1 | 0 | 0 |
2010-05-02T21:27:00.000
| 2 | 0.197375 | false | 2,755,069 | 0 | 0 | 1 | 1 |
What is the best way to create a custom document editor in GAE? I'm making a website meant for a School Robotics Club (With support for any other organization - DRY).
We currently use Google services for online collaboration, I'm wondering if there is a way to tap into Google Docs and allow users to edit a Google Document without using Google Accounts or the Google Docs [EDIT]interface website[/EDIT].
If that is not possible (I've researched and I don't think it is), what is the best way to make a document editor? I want it completely on the website I'm creating, so I'm assuming just some javascript editor like TinyMCE + Ajax + Datastore. Is their anything that replicates Google Doc's/Microsoft Offices's/OpenOffice.org's feature set as far as fonts, spacing, alignment, justification, etc.?
|
Does Mailman have an API or an export lists, users and owners option?
| 3,154,975 | 4 | 2 | 2,988 | 0 |
python,api,mailman
|
probably too late, but the list_members LISTNAME command (executed from a shell) will give you all the members of a list.
list_admins LISTNAME will give you the owners
What do you mean by membership type? list_members does have an option to filter on digest vs non-digest members. I don't think there's a way to get the moderation flag without writing a script for use with withlist
| 0 | 0 | 1 | 1 |
2010-05-03T05:41:00.000
| 3 | 0.26052 | false | 2,756,311 | 0 | 0 | 1 | 1 |
I am trying to migrate a legacy mailing list to a new web forum software and was wondering if mailman has an export option or an API to get all lists, owners, members and membership types.
|
Beginning python for the web
| 4,735,025 | 0 | 2 | 617 | 0 |
php,python
|
I just started Python for web myself. I also came from a PHP background and felt that PHP is fine when it comes to making regular stuff like forums, blogs and stuff like that. Sadly though I didn't like PHP when it came to create more complex systems.
I looked at a few of the different frameworks out there and came to the conclusion if I want to use a Framework that applies as much to web as to client and server side programming Turbogears2 would suit med best.
Seems like one of the "newer" frameworks and looks like they got a solid community that will keep they going for years to come.
Oh, lol this post sounds like and ad. Sorry ;)
Anyway, I like to use webpages that you can work with the hardware on the server, which means CGI/WSGI or just Turbogears :)
| 0 | 0 | 0 | 1 |
2010-05-05T03:33:00.000
| 4 | 0 | false | 2,770,426 | 0 | 0 | 1 | 1 |
I'm looking for a nice tutorial or framework for developing Python written web applications.
I've done lots in PHP, but very little in Python or Ruby and figured I'd start with the first one alphabetically.
|
Can I use django.contrib.gis on GAE?
| 2,775,206 | 4 | 4 | 523 | 0 |
python,django,google-app-engine,gis
|
No. You can't use Django models on App Engine, and therefore, can't use anything else that uses them, such as django.contrib.gis.
| 0 | 0 | 0 | 0 |
2010-05-05T15:45:00.000
| 3 | 1.2 | true | 2,774,723 | 0 | 0 | 1 | 2 |
Can I use GeoDjango with GAE / BigTable?
|
Can I use django.contrib.gis on GAE?
| 2,775,406 | 5 | 4 | 523 | 0 |
python,django,google-app-engine,gis
|
Another limitation is that the GEOS and GDAL libs aren't available on App Engine.
| 0 | 0 | 0 | 0 |
2010-05-05T15:45:00.000
| 3 | 0.321513 | false | 2,774,723 | 0 | 0 | 1 | 2 |
Can I use GeoDjango with GAE / BigTable?
|
Why doesn't IronRuby have the same tools that IronPython does?
| 2,789,483 | 1 | 0 | 580 | 0 |
ironpython,ironruby,ironpython-studio
|
Shortly the same support for IronRuby is arriving to visual studio. It will take maybe another couple of months but then it will get there. They first needed to get the language implementation right.
| 0 | 0 | 0 | 1 |
2010-05-05T20:57:00.000
| 3 | 0.066568 | false | 2,776,721 | 1 | 0 | 1 | 2 |
I've been using Ruby as my main scripting language for years but switched to .NET several years ago. I'd like to continue using Ruby (primarily for testing) BUT the toolset for IronRuby is really nonexistent. Why?
In Python, meanwhile, there are project templates and full intellisense support. Why isn't there something like that for IronRuby? The only thing I've been able to find on it is "there are no plans for VS integration at this time." Why???
|
Why doesn't IronRuby have the same tools that IronPython does?
| 2,778,756 | 1 | 0 | 580 | 0 |
ironpython,ironruby,ironpython-studio
|
IronRuby has been out for 4 weeks, IronPython for 4 years. Developing an IDE takes months, if not years. When exactly where they supposed to squeeze that in?
Also, I believe the IronRuby team is smaller than the IronPython team.
There actually is a Ruby plugin for Visual Studio produced by SapphireSteel. It's called Ruby in Steel. Unfortunately, they currently only support MRI, YARV and JRuby. They did have IronRuby support at one point, but they removed it, because a) none of their customers actually used it, b) IronRuby was still changing faster than they could adapt and c) some of the IronRuby developers announced that Microsoft is considering developing IronRuby support for Visual Studio in the future and SapphireSteel didn't see much business sense in trying to compete with Microsoft.
Also, Visual Studio is not the only IDE on the planet. MonoDevelop has an open bug for IronRuby support, for example. And I'm pretty confident that it wouldn't be too hard to add IronRuby support to NetBeans: it already supports JRuby, MRI and YARV.
| 0 | 0 | 0 | 1 |
2010-05-05T20:57:00.000
| 3 | 0.066568 | false | 2,776,721 | 1 | 0 | 1 | 2 |
I've been using Ruby as my main scripting language for years but switched to .NET several years ago. I'd like to continue using Ruby (primarily for testing) BUT the toolset for IronRuby is really nonexistent. Why?
In Python, meanwhile, there are project templates and full intellisense support. Why isn't there something like that for IronRuby? The only thing I've been able to find on it is "there are no plans for VS integration at this time." Why???
|
page separator in Kate editor
| 2,780,096 | 2 | 3 | 582 | 0 |
python,coding-style,kate
|
Ctrl-L simply refers to the character with ASCII code 12 (form feed, new page). It is called Ctrl-L only because some editors allow you to enter it with Ctrl-L. (For instance, in vim, one can type Ctrl-Q Ctrl-L to enter that character, and it also appears as ^L). In Kate, Ctrl-L is a shortcut for saving all files, so you cannot type it that way and I'm not sure there is any way of entering that character easily.
| 0 | 0 | 0 | 0 |
2010-05-06T09:29:00.000
| 3 | 1.2 | true | 2,779,970 | 1 | 0 | 1 | 2 |
PEP 8 says:
Python accepts the control-L (i.e. ^L)
form feed character as whitespace;
Many tools treat these characters as
page separators, so you may use them
to separate pages of related sections
of your file
This look like a great idea for me, but in the text editor I use(kate) "control+L" is for save all files. Someone have any solution?
... or I'm losing something here?
|
page separator in Kate editor
| 18,721,903 | 2 | 3 | 582 | 0 |
python,coding-style,kate
|
As a Kate developer, I unfortunately have to tell you that such control sequences are not supported. In fact, Kate often treats these files as binary files, since such characters are not human readable text. So in short: Try to avoid ^L.
| 0 | 0 | 0 | 0 |
2010-05-06T09:29:00.000
| 3 | 0.132549 | false | 2,779,970 | 1 | 0 | 1 | 2 |
PEP 8 says:
Python accepts the control-L (i.e. ^L)
form feed character as whitespace;
Many tools treat these characters as
page separators, so you may use them
to separate pages of related sections
of your file
This look like a great idea for me, but in the text editor I use(kate) "control+L" is for save all files. Someone have any solution?
... or I'm losing something here?
|
django authentication .htaccess static
| 2,780,948 | 1 | 2 | 1,305 | 0 |
python,django,apache
|
Use python to rewrite the .htaccess automatically?
Use a database with users and use a Apache sessions to authenticate?
| 0 | 0 | 0 | 0 |
2010-05-06T12:03:00.000
| 5 | 0.039979 | false | 2,780,893 | 0 | 0 | 1 | 1 |
In my app users can upload files for other users.
To make the uploaded files accesible only for the addresse I need some kind of static files authentication system.
My idea, is to create the apache hosted directory for each user and to limit access to this derectory using .htaccess.
This means that each time new django user is created, I need to create a directory and the appropriate .htaccess file in it. I know I should do it using post_save signals on User model but I don't know how to create the .htaccess in the user's directory from python level. Can you help me with that?
Or perhaps you have better solution to my problem?
|
Print string as HTML
| 2,786,862 | 0 | 1 | 764 | 0 |
python,html,newline,genshi
|
Maybe use a <pre> tag.
| 0 | 0 | 0 | 1 |
2010-05-07T07:03:00.000
| 4 | 0 | false | 2,786,803 | 0 | 0 | 1 | 1 |
I would like to know if is there any way to convert a plain unicode string to HTML in Genshi, so, for example, it renders newlines as <br/>.
I want this to render some text entered in a textarea.
Thanks in advance!
|
Can you authenticate Facebook Graph entirely from command line with Python?
| 7,356,440 | 1 | 4 | 1,483 | 0 |
python,facebook,oauth
|
If you only need to authenticate as one user, you can get an access token with the offline_access permission that will last forever and just bake that into the script.
| 0 | 0 | 1 | 0 |
2010-05-07T21:04:00.000
| 2 | 0.099668 | false | 2,791,683 | 0 | 0 | 1 | 1 |
I'm writing a (tabbed) application for Facebook that requires a background process to run on a server and, periodically, upload images to an album on this application's page.
What I'm trying to do is create a script that will:
a) authenticate me with the app
b) upload an image to a specific album
All of this entirely from the command line and completely with the new Graph API.
My problem right now is trying to locate the documentation that will allow me to get a token without a pop-up window of sorts.
Thoughts?
|
How to add a context processor from a Django app
| 2,797,899 | -1 | 1 | 933 | 0 |
python,django,django-apps
|
Yeah, adding a context processor is the most recommended approach to achieve this.
| 0 | 0 | 0 | 0 |
2010-05-09T14:12:00.000
| 3 | -0.066568 | false | 2,797,878 | 0 | 0 | 1 | 2 |
Say I'm writing a Django app, and all the templates in the app require a certain variable.
The "classic" way to deal with this, afaik, is to write a context processor and add it to TEMPLATE_CONTEXT_PROCESSORS in the settings.py.
My question is, is this the right way to do it, considering that apps are supposed to be "independent" from the actual project using them?
In other words, when deploying that app to a new project, is there any way to avoid the project having to explicitly mess around with its settings?
|
How to add a context processor from a Django app
| 2,797,969 | 1 | 1 | 933 | 0 |
python,django,django-apps
|
Your assumption that apps can just be added in a project without touching the project's settings is not correct.
If you add an application to a project, you have to edit the settings, since you must add it in the INSTALLED_APPS tuple.
So why not edit the context processor list?
| 0 | 0 | 0 | 0 |
2010-05-09T14:12:00.000
| 3 | 1.2 | true | 2,797,878 | 0 | 0 | 1 | 2 |
Say I'm writing a Django app, and all the templates in the app require a certain variable.
The "classic" way to deal with this, afaik, is to write a context processor and add it to TEMPLATE_CONTEXT_PROCESSORS in the settings.py.
My question is, is this the right way to do it, considering that apps are supposed to be "independent" from the actual project using them?
In other words, when deploying that app to a new project, is there any way to avoid the project having to explicitly mess around with its settings?
|
Django Python Macports
| 7,845,384 | 1 | 1 | 3,721 | 0 |
python,django,uninstallation,macports
|
django with Macport should work. py26-django or py27-django. It is the python version you are using that causes the problem.
Check to see if you are using the python comes with Mac or python installed via macport. Try python, python2.6, python2.7 from the terminal.
On my Mac (OSX 10.6.8) the default python version is 2.6.1. The macport version is 2.6.7.
You can replace the /usr/bin/python with the macport version by using 'ln -s'
| 0 | 0 | 0 | 0 |
2010-05-10T13:06:00.000
| 2 | 0.099668 | false | 2,802,782 | 0 | 0 | 1 | 1 |
I installed Django via Macports.
I wasted a lot of time on making it work.
It still does not work.
I would like to COMPLETELY uninstall Django (Macports) and install with the easy install (DJANGO).
I would like to keep Macports and not uninstall it, because I read it SHOULD be useful.
How can I achieve this?
Thank you for your attention.
|
Whats the best way to extend Anonymous User in Django?
| 2,809,873 | 14 | 14 | 5,125 | 0 |
python,django,authentication
|
Your middleware suggestion got me thinking, and I now think the best idea is to overwrite the standard AuthenticationMiddleware. That class assigns a LazyUser object to the request, which is resolved to the correct user, when accessed, by calling contrib.auth.get_user. This is probably the right place to override things, so that it calls your customised get_user function which returns your subclassed AnonymousUser.
| 0 | 0 | 0 | 0 |
2010-05-11T07:15:00.000
| 6 | 1.2 | true | 2,808,723 | 0 | 0 | 1 | 2 |
I want to make my User objects all have the same base behaviour and to do so I need to add a couple of methods / properties to Anonymous User.
I've already subclassed User to make richer user objects but I was wondering if anyone has done the same for Anonymous User? And if there are any preferred ways of doing it!
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.