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
How to monkey patch __init__ module in Python?
4,877,513
0
5
2,709
0
python,django,init,monkeypatching
You can just edit the __init__.py file. There's nothing stopping you and if you do it right nothing bad will happen.
0
0
0
0
2011-02-02T17:08:00.000
2
0
false
4,877,457
1
0
1
2
I know, I know, it's dirty and all. I want to know if it's possible to hijack the __init__ module of a Python module to replace it by your own. I'm asking that because I need to prevent a django lib to start some part of it's init process that make it crashes with our configuration. And yes, it's better to fix the djan...
How to monkey patch __init__ module in Python?
4,877,628
4
5
2,709
0
python,django,init,monkeypatching
One way to hijack the import procedure is to simulate the import sometime before it takes place, in another module that is imported before the one you want to monkey-patch. Insert whatever you want into sys.modules with the name of the module as the key, and when the time comes to import the original module, Python wil...
0
0
0
0
2011-02-02T17:08:00.000
2
0.379949
false
4,877,457
1
0
1
2
I know, I know, it's dirty and all. I want to know if it's possible to hijack the __init__ module of a Python module to replace it by your own. I'm asking that because I need to prevent a django lib to start some part of it's init process that make it crashes with our configuration. And yes, it's better to fix the djan...
Django (w PyCharm) & PYTHON PATH issue
5,418,074
10
5
5,796
0
python,django,pythonpath,pycharm
In pycharm open the settings "cmd" + "," and then to "Project Structure" click on "Sources" to include any modules.
0
0
0
0
2011-02-02T19:03:00.000
2
1
false
4,878,661
1
0
1
2
I have purchased PyCharm and am trying to get things to work however I am encountering this issue.. Once I start a project everything works great... Now if I want a standalone app.. let's say at /users/me/djangoApps I understand I have to add this directory to the python path.. I am trying to do so by creating a file ...
Django (w PyCharm) & PYTHON PATH issue
4,878,982
2
5
5,796
0
python,django,pythonpath,pycharm
Don't add that file to your python site-packages, then your django project is gonna be included for all future projects down the road. If you wanna debug, within PyCharm, click the Run tab up top and choose Edit configurations. Choose the project you are working with and make sure you add the directory where your manag...
0
0
0
0
2011-02-02T19:03:00.000
2
0.197375
false
4,878,661
1
0
1
2
I have purchased PyCharm and am trying to get things to work however I am encountering this issue.. Once I start a project everything works great... Now if I want a standalone app.. let's say at /users/me/djangoApps I understand I have to add this directory to the python path.. I am trying to do so by creating a file ...
Django: "projects" vs "apps"
4,879,235
70
215
51,295
0
python,django,namespaces,project-organization
Try to answer question: "What does my application do?". If you cannot answer in a single sentence, then maybe you can split it into several apps with cleaner logic. I read this thought somewhere soon after I've started to work with django and I find that I ask this question of myself quite often and it helps m...
0
0
0
0
2011-02-02T19:41:00.000
6
1
false
4,879,036
0
0
1
2
I have a fairly complex "product" I'm getting ready to build using Django. I'm going to avoid using the terms "project" and "application" in this context, because I'm not clear on their specific meaning in Django. Projects can have many apps. Apps can be shared among many projects. Fine. I'm not reinventing the blog or...
Django: "projects" vs "apps"
4,880,013
8
215
51,295
0
python,django,namespaces,project-organization
If so... in terms of Django's project.app namespace, my inclination is to usemyproduct.myproduct, but of course this isn't allowed There is nothing like not allowed. Its your project, no one is restricting you. It is advisable to keep a reasonable name. I don't see any portion of my product being reusable in any co...
0
0
0
0
2011-02-02T19:41:00.000
6
1
false
4,879,036
0
0
1
2
I have a fairly complex "product" I'm getting ready to build using Django. I'm going to avoid using the terms "project" and "application" in this context, because I'm not clear on their specific meaning in Django. Projects can have many apps. Apps can be shared among many projects. Fine. I'm not reinventing the blog or...
django - "manage.py test" fails "table already exists"
4,882,942
15
8
5,175
0
python,django
It might be an error in one of your south migrations. You don't see the problem on the real db because the migration has been executed (with the--fake option maybe) You can try to recreate the db from scracth and see if it works. You can also disable South for unit-tests by adding SOUTH_TESTS_MIGRATE = False in your se...
0
0
0
0
2011-02-03T03:26:00.000
4
1.2
true
4,882,377
0
0
1
3
I'm new to the django world. Running some tutorial apps, and when running python manage.py test i'm getting a failure saying that the table already exists. I'm not sure what is going on. I am also running south, and I got no errors when migrating the schema. Any insight is greatly appreciated. TIA Joey
django - "manage.py test" fails "table already exists"
7,374,886
0
8
5,175
0
python,django
and if you are testing with nose: DST_RUN_SOUTH_MIGRATIONS = False
0
0
0
0
2011-02-03T03:26:00.000
4
0
false
4,882,377
0
0
1
3
I'm new to the django world. Running some tutorial apps, and when running python manage.py test i'm getting a failure saying that the table already exists. I'm not sure what is going on. I am also running south, and I got no errors when migrating the schema. Any insight is greatly appreciated. TIA Joey
django - "manage.py test" fails "table already exists"
18,020,458
0
8
5,175
0
python,django
This happens also with Nose when --cover-package=userdata,incorrectname One of package's name is incorrect
0
0
0
0
2011-02-03T03:26:00.000
4
0
false
4,882,377
0
0
1
3
I'm new to the django world. Running some tutorial apps, and when running python manage.py test i'm getting a failure saying that the table already exists. I'm not sure what is going on. I am also running south, and I got no errors when migrating the schema. Any insight is greatly appreciated. TIA Joey
Django + Apache + Windows WSGIDaemonProcess Alternative
8,750,220
1
6
2,617
1
python,django,apache,subprocess,mod-wsgi
I ran into a couple of issues trying to use subprocess under this configuration. Since I am not sure what specifically you had trouble with I can share a couple of things that were not easy for me to solve but in hindsight seem pretty trivial. I was receiving permissions related errors when trying to execute an applic...
0
0
0
0
2011-02-03T04:07:00.000
2
0.099668
false
4,882,605
0
0
1
1
After setting up a django site and running on the dev server, I have finally gotten around to figuring out deploying it in a production environment using the recommended mod_wsgi/apache22. I am currently limited to deploying this on a Windows XP machine. My problem is that several django views I have written use the py...
Allow "third party" plugins for my Django app, that don't require config changes?
4,891,078
2
3
827
0
python,django
My suggestion would be to use the Django signal system. Your app should send signals when certain actions occur and then listen to them when the next stage happens. If someone wants to change the behaviour of your app, all they would need to do would be to listen to the relevant signals that your app sends out and modi...
0
0
0
0
2011-02-03T19:53:00.000
2
1.2
true
4,890,971
0
0
1
1
I would like to know of a good approach, or programming "pattern" to apply, to allow users of my Django application to drop in "plugins" or "extensions" for my app, without having to add anything to 'installed apps' or edit any configuration. WordPress plugins probably being the best example. New options/settings/menu...
Django: Faking a field in the admin interface?
5,409,234
6
15
11,911
0
python,django,django-admin
It's easy enough to get arbitrary data to show up in change list or make a field show up in the form: list_display arbitrarily takes either actual model properties, or methods defined on the model or the modeladmin, and you can subclass forms.ModelForm to add any field type you'd like to the change form. What's far mor...
0
0
0
0
2011-02-03T20:43:00.000
4
1
false
4,891,506
0
0
1
1
I have a model, Foo. It has several database properties, and several properties that are calculated based on a combination of factors. I would like to present these calculated properties to the user as if they were database properties. (The backing factors would be changed to reflect user input.) Is there a way to do t...
How can I access the view function in a Django template tag?
4,891,762
1
0
3,003
0
python,django,django-templates
A view function doesn't have any special status in Django. A template can be rendered anywhere: in a view, inside a templatetag, in a model method, in a utility function... so it's not even clear what you would want to access. But in any case, the general principle is that if you want access to something in a template,...
0
0
0
0
2011-02-03T21:02:00.000
4
0.049958
false
4,891,699
0
0
1
1
What it says on the tin: I want to be able to access either: the view function itself the view name (although this is less useful, I can probably use it to get back to the function) attributes of the view function This needs to be accessed from within a template tag. In short, what I'm trying to do is to mark up view...
Django: String representation of models
4,892,163
23
11
14,854
0
python,django
You can also try __repr__ and __str__ for your logging/debugging purposes. It is possible (at least it should be this way) that your logger/debugger uses repr( object ) to log your objects.
0
0
0
0
2011-02-03T21:40:00.000
2
1
false
4,892,049
0
0
1
1
I would like my models to have two string representations: one that is displayed in the backend logs for debugging purposes, and a cleaner one that is displayed to end users when the model is represented in the HTML. Right now, I'm just overriding __unicode__(). Is there a way to do this?
Which programming language to choose?
4,896,404
0
2
436
0
c++,python,ruby-on-rails
Language should be a means to an end. Pick a project you want to work on, then figure out what you will need to know to get the job done. It's very difficult to get any language-learning to stick without some practical application. And "knowing a language" is not particularly difficult or useful. Knowing how to us...
0
0
0
1
2011-02-04T09:22:00.000
3
0
false
4,896,361
1
0
1
2
I am a 3rd year CS engineering student, I have done some basic programming in languages like C,C++,Java,Shell,Perl,PHP,Ruby on Rails, Python. But now I wanted to settle for one language, so I thought of finally mastering one scripting language and other compiled one. So I decided to stick with C++ and Python. Can someo...
Which programming language to choose?
4,896,389
0
2
436
0
c++,python,ruby-on-rails
Presently ROR is high in demand for web. As a professional i'll suggest to learn ROR.
0
0
0
1
2011-02-04T09:22:00.000
3
0
false
4,896,361
1
0
1
2
I am a 3rd year CS engineering student, I have done some basic programming in languages like C,C++,Java,Shell,Perl,PHP,Ruby on Rails, Python. But now I wanted to settle for one language, so I thought of finally mastering one scripting language and other compiled one. So I decided to stick with C++ and Python. Can someo...
Creating a python web server to recieve XML HTTP Requests
4,898,364
0
1
1,735
0
python,http,xmlhttprequest
There's absolutely no need to write your own web server. Plenty of options exist, including lightweight ones like nginx. You should use one of those, and either your own custom WSGI code to receive the request, or (better) one of the microframeworks like Flask or Bottle.
0
0
1
0
2011-02-04T12:39:00.000
3
0
false
4,898,066
0
0
1
1
I am currently working on a project to create simple file uploader site that will update the user of the progress of an upload. I've been attempting this in pure python (with CGI) on the server side but to get the progress of the file I obviously need send requests to the server continually. I was looking to use AJAX ...
Converting a dynamic PHP/mySQL website to an archived HTML version?
4,901,187
1
1
1,156
0
php,python,dynamic,static,archive
Using PHP you could write a simple script that would do this: Save current page. Follow links from that page and saving those pages (and for each page repeat from 1). Replace URLs on current page with those leading to saved pages.
0
0
0
1
2011-02-04T17:30:00.000
3
0.066568
false
4,901,039
0
0
1
1
I have a PHP/mySQL site that is no longer going to get any new content added. But I'd like to keep what I do have as an archive and keep it online. Ideally I'd like to convert it to a static site so that it no longer requires a database. If anyone else has gone through this process, are there any tools, scripts, or met...
RESTful Webservice with embedded IronPython: engine & scope questions
4,903,621
2
1
627
0
c#,web-services,ironpython,openrasta
Per request is the way to go unless all of your code is thread safe. You may get better performance using per application (per session implies you have th notion of "sesions" between you client and server), however the implication there is that all of your code in the "application" is thread safe. So per-request is wha...
0
0
0
0
2011-02-04T21:05:00.000
2
0.197375
false
4,902,933
0
0
1
2
I have a RESTful C# web service (using Open Rasta) that I want to run IronPython scripts that talk to a CouchDB. One thing I could use some clarification on is: How often do I need a new instance of the python engine and the scope? one each per application? per session? per request? I currently have a static engine at ...
RESTful Webservice with embedded IronPython: engine & scope questions
4,903,789
3
1
627
0
c#,web-services,ironpython,openrasta
A ScriptRuntime/ScriptEngine per application and a Scope per request is exactly how it should be done. Runtimes/Engine are thread-safe and Scopes are not.
0
0
0
0
2011-02-04T21:05:00.000
2
1.2
true
4,902,933
0
0
1
2
I have a RESTful C# web service (using Open Rasta) that I want to run IronPython scripts that talk to a CouchDB. One thing I could use some clarification on is: How often do I need a new instance of the python engine and the scope? one each per application? per session? per request? I currently have a static engine at ...
Pycharm (Python IDE) doesn't auto complete Django modules
40,809,492
2
18
14,576
0
python,django,init,pycharm
I worked out this fix: Go to Preferences > Project:{YourProject} > Python interpreter. I saw that the field for "Project interpreter" said "2.7...", but I was coding with python 3.4 and my project was created with python 3.4. Replace the version of python in the "Project interpreter" field with the Python version by m...
0
0
0
0
2011-02-05T10:07:00.000
7
0.057081
false
4,906,246
1
0
1
4
My Python IDE (pycharm) has stopped auto completing my modules (suggestions). I get unresolved references after every django module I try to import so: from django - works, however soon as I add a 'dot' it fails so from django.db import models gives me unresolved errors... The ackward thing is after compiling reference...
Pycharm (Python IDE) doesn't auto complete Django modules
56,934,298
0
18
14,576
0
python,django,init,pycharm
you should just change your project interpreter if it is using anaconda or etc to standard python interpreter which may be located in this path (C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\python.exe)
0
0
0
0
2011-02-05T10:07:00.000
7
0
false
4,906,246
1
0
1
4
My Python IDE (pycharm) has stopped auto completing my modules (suggestions). I get unresolved references after every django module I try to import so: from django - works, however soon as I add a 'dot' it fails so from django.db import models gives me unresolved errors... The ackward thing is after compiling reference...
Pycharm (Python IDE) doesn't auto complete Django modules
24,810,990
2
18
14,576
0
python,django,init,pycharm
Trivial solution that worked for me: start a new django project using pycharm project options. Try auto-completing using a django import module. If it works, switch back to your original project and auto-complete should be working fine. I still don't understand why this works.
0
0
0
0
2011-02-05T10:07:00.000
7
0.057081
false
4,906,246
1
0
1
4
My Python IDE (pycharm) has stopped auto completing my modules (suggestions). I get unresolved references after every django module I try to import so: from django - works, however soon as I add a 'dot' it fails so from django.db import models gives me unresolved errors... The ackward thing is after compiling reference...
Pycharm (Python IDE) doesn't auto complete Django modules
7,276,265
21
18
14,576
0
python,django,init,pycharm
I had exactly the same issue and couldn't find a definitive answer. Just invalidating caches didn't work for me. The problem lies in the fact that, at some point, __init__.py files got registered as text files and messed up the indexing. I worked out this fix: Preferences > File Types > Text Files. Remove __init__.py ...
0
0
0
0
2011-02-05T10:07:00.000
7
1
false
4,906,246
1
0
1
4
My Python IDE (pycharm) has stopped auto completing my modules (suggestions). I get unresolved references after every django module I try to import so: from django - works, however soon as I add a 'dot' it fails so from django.db import models gives me unresolved errors... The ackward thing is after compiling reference...
Python web frameworks vs Java web frameworks (how is web development in Python done?)
4,909,342
2
6
5,940
0
java,python,templates,web-frameworks
It may sound strange, but there's no need to know "how web development is performed in Python" to start doing it. In fact, working with language/framework/etc is a single most reliable way to get understanding of it. You won't gain a lot from one-page summaries. Also, comparing it with Java isn't likely to help. There'...
0
0
0
1
2011-02-05T19:57:00.000
4
0.099668
false
4,909,306
0
0
1
2
I am thinking in starting a personal pet web project to experiment with different things and extend my knowledge. I use Java a lot at work (for web applications :D) and was thinking in making my own in Python since I kinda like this language but never passed the simple scripts stages. I want to step up a gear regardi...
Python web frameworks vs Java web frameworks (how is web development in Python done?)
6,586,407
3
6
5,940
0
java,python,templates,web-frameworks
hi try bottle python framework (bottle.paws.de / bottlepy.org) its really nice to use blistering fast and gets out of your way + the best thing about it is that its one single file to import, i recently migrated from PHP and i have to tell you am so ... loving it!
0
0
0
1
2011-02-05T19:57:00.000
4
0.148885
false
4,909,306
0
0
1
2
I am thinking in starting a personal pet web project to experiment with different things and extend my knowledge. I use Java a lot at work (for web applications :D) and was thinking in making my own in Python since I kinda like this language but never passed the simple scripts stages. I want to step up a gear regardi...
Problem with mod_wsgi
4,922,237
2
0
257
0
python,mod-wsgi
If using embedded mode of mod_wsgi you use WSGIPythonPath directive. If you are using daemon mode, you use the python-path option to the appropriate WSGIDaemonProcess directive. Ensure you are not using mod_wsgi 1.X and not using mod_python in same Apache.
0
0
0
0
2011-02-06T01:14:00.000
1
0.379949
false
4,910,875
0
0
1
1
I installed my django project on Apache web server using mod_wsgi. I used a WSGIScriptAlias directive inside VirtualHost, pointing to a wsgi_handler.py file in my project. It worked fine. Nevertheless, I had to write inside the wsgi_handler.py something like: sys.append(absolute_file_path) in order to include some pyt...
ImproperlyConfigured: Error importing middleware django.middleware.common: "No module named _md5"
5,279,438
0
2
6,980
0
python,django,apache,ubuntu,mod-wsgi
So to wrap this up, we ended up re-installing the OS. I know this is a cop out but it fixed the problem for us. Thanks for everyone's help!
0
0
0
0
2011-02-06T03:11:00.000
3
1.2
true
4,911,289
0
0
1
2
I am running Apache2 on Ubuntu 9 with python 2.6.2 installed. I get the following error when I try to access a page on my django application: File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 42, in load_middleware raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%...
ImproperlyConfigured: Error importing middleware django.middleware.common: "No module named _md5"
4,911,387
1
2
6,980
0
python,django,apache,ubuntu,mod-wsgi
Try to append to python path you project directory and parent one sys.path.append('path_to_dynamicuddi_project') sys.path.append('path_to_dynamicuddi_parent_dir')
0
0
0
0
2011-02-06T03:11:00.000
3
0.066568
false
4,911,289
0
0
1
2
I am running Apache2 on Ubuntu 9 with python 2.6.2 installed. I get the following error when I try to access a page on my django application: File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 42, in load_middleware raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%...
Extract 2nd level domain from domain? - Python
4,916,929
3
7
3,869
0
javascript,jquery,python,html,django
Problem in mix of extractions 1st and 2nd level. Trivial solution... Build list of possible site suffixes, ordered from narrow to common case. "co.uk", "uk", "co.jp", "jp", "com" And check, Can suffix be matched at end of domain. if matched, next part is site.
0
0
0
0
2011-02-06T23:20:00.000
6
0.099668
false
4,916,890
1
0
1
2
I have a list of domains e.g. site.co.uk site.com site.me.uk site.jpn.com site.org.uk site.it also the domain names can contain 3rd and 4th level domains e.g. test.example.site.org.uk test2.site.com I need to try and extract the 2nd level domain, in all these cases being site Any ideas? :)
Extract 2nd level domain from domain? - Python
4,916,933
2
7
3,869
0
javascript,jquery,python,html,django
The only possible way would be via a list with all the top level domains (here like .com or co.uk) possible. Then you would scan through this list and check out. I don't see any other way, at least without accessing the internet at runtime.
0
0
0
0
2011-02-06T23:20:00.000
6
0.066568
false
4,916,890
1
0
1
2
I have a list of domains e.g. site.co.uk site.com site.me.uk site.jpn.com site.org.uk site.it also the domain names can contain 3rd and 4th level domains e.g. test.example.site.org.uk test2.site.com I need to try and extract the 2nd level domain, in all these cases being site Any ideas? :)
Starting a long running process on a server from a WSGI application
4,919,128
2
3
919
0
python,wsgi
Isolate the process as a separate daemon, and use MQ or some other IPC to hand it jobs. Have it update a value in a database as it progresses, and read that value in a web page.
0
0
0
0
2011-02-07T07:15:00.000
2
0.197375
false
4,918,867
0
0
1
2
I need to start a long running process (30 min) via http and get status as it's running. The "process" is basically a Python script that updates a database. I have the following constraints: Only one instance of the process can run at a time. The WSGI application is running in several interpreters, so I can't just mak...
Starting a long running process on a server from a WSGI application
4,922,650
1
3
919
0
python,wsgi
Look at using Celery (http://celeryproject.org/) and run the task outside of the Python web application processes.
0
0
0
0
2011-02-07T07:15:00.000
2
0.099668
false
4,918,867
0
0
1
2
I need to start a long running process (30 min) via http and get status as it's running. The "process" is basically a Python script that updates a database. I have the following constraints: Only one instance of the process can run at a time. The WSGI application is running in several interpreters, so I can't just mak...
How do I do logging in a WSGI application across several processes?
4,922,546
1
3
1,543
0
python,logging,wsgi
Direct logging output to sys.stderr. Doing that will see anything logged get routed into the internal Apache logging routines and into the Apache error logs. The way Apache does this works when done from multiple process at the same time.
0
0
0
0
2011-02-07T08:03:00.000
3
0.066568
false
4,919,133
0
0
1
1
I have a simple webservice written in Python WSGI, it's running in Apache and modwsgi using the WSGIDaemonProcess processes=4 directive. How do I add logging? Obviously I can't log to the same file without some sort of mutex, but I don't want performance degraded. The logging can't block. As far as I know the standard...
Actionscript Three Asymmetric Encryption
4,999,135
0
0
191
0
python,actionscript,cryptography,token,encryption-asymmetric
After doing some research I have decided to code the part of rsa I need from scratch. I found some python code that will generate raw integer keys of any length and looked up how the rsa algorithm works. T^P = X (mod R) to encrypt X^Q = T (mod R) to decrypt Where T is the starting data, X is the ending data, P is the p...
0
0
0
1
2011-02-08T08:53:00.000
3
1.2
true
4,931,126
0
0
1
3
I cant seem to find a reliable asymmetric encryption solution to secure data between a python based server application and a client over an open data channel. I need some way for my client to prevent a man in the middle attack over an open data channel, my current exchange has me sending my clients a token they use to ...
Actionscript Three Asymmetric Encryption
4,947,928
0
0
191
0
python,actionscript,cryptography,token,encryption-asymmetric
Hardcoding they public keys won't help you, if someone really plans an attack, because the SWF itself is transfered over an unsafe channel, thus the keys can be exchanged just as if they were transmitted individually. There is basically nothing you can do to prevent man in the middle attacks, you can only make them har...
0
0
0
1
2011-02-08T08:53:00.000
3
0
false
4,931,126
0
0
1
3
I cant seem to find a reliable asymmetric encryption solution to secure data between a python based server application and a client over an open data channel. I need some way for my client to prevent a man in the middle attack over an open data channel, my current exchange has me sending my clients a token they use to ...
Actionscript Three Asymmetric Encryption
4,947,858
0
0
191
0
python,actionscript,cryptography,token,encryption-asymmetric
Since decompiling swf content is not a major problem for experienced hackers, I would strongly advise against hardcoding keys. Have you thought about using SSL at all?
0
0
0
1
2011-02-08T08:53:00.000
3
0
false
4,931,126
0
0
1
3
I cant seem to find a reliable asymmetric encryption solution to secure data between a python based server application and a client over an open data channel. I need some way for my client to prevent a man in the middle attack over an open data channel, my current exchange has me sending my clients a token they use to ...
Loading a pickled list just once - Django\Python
4,933,720
2
3
1,933
0
python,django,django-views,pickle
I'd write a python module - a singleton class with an init method that reads the pickled data into a python object, and then whatever 'get' methods you need to get the info out. Then in your settings.py you just call the initialisation method. Anything that needs to get info from it just imports the module and uses the...
0
0
0
0
2011-02-08T12:46:00.000
3
0.132549
false
4,933,190
1
0
1
1
I have a pickle file that contains a list of compiled regexes and other data. It takes about 1-1.5 seconds to load. What could a good way of using this list into my views, but have pickle work on the file just once? Edit: would importing into settings.py be considered ok? Any ideas?
Testing Apache/mod_jk/Tomcat configuration upgrade
4,949,650
0
0
361
0
python,apache,tomcat,web-scraping,mod-jk
In order to accomplish what I wanted to do, I just went back to basics. Mechanize is somewhat bulky, and there was a lot of bloat involved in the main functionality tests I had before. So I started with a clean slate and just used cookielib.CookieJar and urllib2 to build a linear test and then run them in a while 1 loo...
0
0
0
0
2011-02-08T17:56:00.000
2
1.2
true
4,936,524
1
0
1
1
We have begun upgrading hardware and software to a 64-bit architecture using Apache with mod_jk and four Tomcat servers (the new hardware). We need to be able to test this equipment with a large number of simultaneous connections while still actually doing things in the app (logging in, etc.) I currently am using Pytho...
TDD django models
4,937,874
6
2
360
0
python,django,tdd
Shouldn't tests test functionality rather than implementation? In other words, test that the field can store an integer, not that it is an IntegerField. Then if that gets changed to a BooleanField your test fails (assuming no coercion), but if it gets changed to a FloatField the test still passes, because it can still ...
0
0
0
0
2011-02-08T20:03:00.000
3
1
false
4,937,762
0
0
1
3
If you're trying to do Test Driven Development, is it sane to write tests that check the column type of your models as you write your models? Like before you write your model, you write a test and say I want an ID field that is an integer field.
TDD django models
4,937,780
7
2
360
0
python,django,tdd
I think it's a bit overkill to test the underlying framework within your app testing, in general. Unless you have a suspicion that it isn't well-tested and/or it is something that may change a lot (say you live by developing against trunk), it should be a reasonable assumption that your framework will operate as adver...
0
0
0
0
2011-02-08T20:03:00.000
3
1.2
true
4,937,762
0
0
1
3
If you're trying to do Test Driven Development, is it sane to write tests that check the column type of your models as you write your models? Like before you write your model, you write a test and say I want an ID field that is an integer field.
TDD django models
4,937,956
3
2
360
0
python,django,tdd
If you don't want to drive yourself crazy, you should focus on tests that will really help you. Testing that the id column is an integer isn't testing your code, it's testing Django. Even testing that "subject" is a string field isn't helping you much. Test that the models can do what they have to do.
0
0
0
0
2011-02-08T20:03:00.000
3
0.197375
false
4,937,762
0
0
1
3
If you're trying to do Test Driven Development, is it sane to write tests that check the column type of your models as you write your models? Like before you write your model, you write a test and say I want an ID field that is an integer field.
Django Admin - change header 'Django administration' text
61,366,946
7
254
156,772
0
python,django,django-admin
Just go to admin.py file and add this line in the file : admin.site.site_header = "My Administration"
0
0
0
0
2011-02-08T21:10:00.000
21
1
false
4,938,491
0
0
1
3
How does one change the 'Django administration' text in the django admin header? It doesn't seem to be covered in the "Customizing the admin" documentation.
Django Admin - change header 'Django administration' text
62,750,378
5
254
156,772
0
python,django,django-admin
You can use these following lines in your main urls.py you can add the text in the quotes to be displayed To replace the text Django admin use admin.site.site_header = "" To replace the text Site Administration use admin.site.site_title = "" To replace the site name you can use admin.site.index_title = "" To replace th...
0
0
0
0
2011-02-08T21:10:00.000
21
0.047583
false
4,938,491
0
0
1
3
How does one change the 'Django administration' text in the django admin header? It doesn't seem to be covered in the "Customizing the admin" documentation.
Django Admin - change header 'Django administration' text
4,938,653
3
254
156,772
0
python,django,django-admin
You just override the admin/base_site.html template (copy the template from django.contrib.admin.templates and put in your own admin template dir) and replace the branding block.
0
0
0
0
2011-02-08T21:10:00.000
21
0.028564
false
4,938,491
0
0
1
3
How does one change the 'Django administration' text in the django admin header? It doesn't seem to be covered in the "Customizing the admin" documentation.
django how to use AUTH_PROFILE_MODULE with multiple profiles?
4,966,022
0
2
1,474
0
python,django,django-models
It may be more hassle to try to use multiple profiles with the simplistic configuration of UserProfile. I would suggest using UserProfile with generic foreign key, or completely ditch UserProfile and create separate models with a User foreign key. If you are going to have a lot of data attached to these extra user pr...
0
0
0
0
2011-02-09T03:50:00.000
2
0
false
4,941,125
0
0
1
1
Assuming I have different profiles for different user types - staff, teacher,students: How do I specify AUTH_PROFILE_MODULE in order to get back the appropriate profile with get_profile?
Which django apps are directly usable or easily adaptable for django-nonrel?
5,656,577
0
2
198
0
python,django,google-app-engine,django-nonrel
I have used 'contenttypes, auth and sessions' from 'django.contrib' without any modification, the app code wont cause any problems. However any query using JOINs result in query errors, so you need to write your queries with this limitation in mind. Did you have a particular app in mind?
0
0
0
0
2011-02-09T21:53:00.000
3
0
false
4,950,962
0
0
1
1
Is there a list of django apps that can be used unaltered in django-nonrel or a list of django apps that can be easily adapted to be used in django-nonrel?
Which version of Python should I use for web development?
4,957,642
1
6
893
0
python,version
Go with Python 2.7, especially if you're looking to do Django work or any other web development. Python 3 isn't supported with Django, and most libraries work with the > 2.5 versions of Python.
0
0
0
0
2011-02-10T13:18:00.000
6
0.033321
false
4,957,545
0
0
1
3
I've finally decided to start working in Python but there seems to be so many versions out there. I'm mainly interested in web development in Python, so which version should I choose? I don't know what versions the web frameworks usually support (Django, Pylons and so on) but maybe you guys know? Also, I'd like to know...
Which version of Python should I use for web development?
4,958,047
0
6
893
0
python,version
You use the version supported by the web framework of your choice. That will typically today be Python 2.6 or 2.7.
0
0
0
0
2011-02-10T13:18:00.000
6
0
false
4,957,545
0
0
1
3
I've finally decided to start working in Python but there seems to be so many versions out there. I'm mainly interested in web development in Python, so which version should I choose? I don't know what versions the web frameworks usually support (Django, Pylons and so on) but maybe you guys know? Also, I'd like to know...
Which version of Python should I use for web development?
4,957,702
0
6
893
0
python,version
If you want to use shared hosters than you should use Version 2.5, because the most of them only have 2.5 (at least in my country). And if you want to use a newer version of Python, 2.7 is compatible to 2.5.
0
0
0
0
2011-02-10T13:18:00.000
6
0
false
4,957,545
0
0
1
3
I've finally decided to start working in Python but there seems to be so many versions out there. I'm mainly interested in web development in Python, so which version should I choose? I don't know what versions the web frameworks usually support (Django, Pylons and so on) but maybe you guys know? Also, I'd like to know...
In django, can you load a django app into the python interpreter like in rails?
4,961,970
24
4
3,150
0
python,django
you mean python manage.py shell ?
0
0
0
0
2011-02-10T19:56:00.000
3
1.2
true
4,961,951
0
0
1
2
In django, can you load a django app into the python interpreter like in rails? i.e. does django have: irb ?
In django, can you load a django app into the python interpreter like in rails?
4,961,987
2
4
3,150
0
python,django
yes, it can be via python manage.py shell, it's also useful to look into the django-extensions plugin for extra functionality such as shell_plus which provides all of the database interactions for the shell environment as welll.
0
0
0
0
2011-02-10T19:56:00.000
3
0.132549
false
4,961,951
0
0
1
2
In django, can you load a django app into the python interpreter like in rails? i.e. does django have: irb ?
In python, is it easy to call a function multiple times using threads?
4,962,704
0
2
1,238
0
python,multithreading
You can do this using any of: the thread module (if your task is a function) the threading module (if you want to write your task as a subclass of threading.Thread) the multiprocessing module (which uses a similar interface to threading) All of these are available in the Python standard library (2.6 and later), and y...
0
0
0
0
2011-02-10T20:02:00.000
2
0
false
4,962,022
1
0
1
1
Say I have a simple function, it connects to a database (or a queue), gets a url that hasn't been visited, and then fetches the HTML at the given URL. Now this process is serial, i.e. it will only fetch the html from a given url one at a time, how can I make this faster by doing this in a group of threads?
BeautifulSoup and lxml.html - what to prefer?
4,967,121
44
40
44,819
0
python,beautifulsoup,lxml
The simple answer, imo, is that if you trust your source to be well-formed, go with the lxml solution. Otherwise, BeautifulSoup all the way. Edit: This answer is three years old now; it's worth noting, as Jonathan Vanasco does in the comments, that BeautifulSoup4 now supports using lxml as the internal parser, so you...
0
0
1
0
2011-02-11T08:49:00.000
4
1.2
true
4,967,103
0
0
1
2
I am working on a project that will involve parsing HTML. After searching around, I found two probable options: BeautifulSoup and lxml.html Is there any reason to prefer one over the other? I have used lxml for XML some time back and I feel I will be more comfortable with it, however BeautifulSoup seems to be much com...
BeautifulSoup and lxml.html - what to prefer?
4,968,489
0
40
44,819
0
python,beautifulsoup,lxml
lxml's great. But parsing your input as html is useful only if the dom structure actually helps you find what you're looking for. Can you use ordinary string functions or regexes? For a lot of html parsing tasks, treating your input as a string rather than an html document is, counterintuitively, way easier.
0
0
1
0
2011-02-11T08:49:00.000
4
0
false
4,967,103
0
0
1
2
I am working on a project that will involve parsing HTML. After searching around, I found two probable options: BeautifulSoup and lxml.html Is there any reason to prefer one over the other? I have used lxml for XML some time back and I feel I will be more comfortable with it, however BeautifulSoup seems to be much com...
What could cause a Django error when debug=False that isn't there when debug=True
11,999,402
1
16
9,930
0
python,django,apache,debugging,importerror
This can also happen if you do not have both a 500.html and 404.html template present. Just the 500 isn't good enough, even for URIs that won't produce a 404!
0
0
0
0
2011-02-11T15:01:00.000
4
0.049958
false
4,970,489
0
0
1
2
Using the development server, it works with debug=True or False. In production, everything works if debug=True, but if debug=False, I get a 500 error and the apache logs end with an import error: "ImportError: cannot import name Project". Nothing in the import does anything conditional on debug - the only code that doe...
What could cause a Django error when debug=False that isn't there when debug=True
4,975,210
7
16
9,930
0
python,django,apache,debugging,importerror
This happens if you have a circular import in one of your files. Check and see if you are importing something from Project and then importing something in Project from the original file that originally imported Project. I ran into this same problem recently, and rearranging some of my imports helped fix the problem.
0
0
0
0
2011-02-11T15:01:00.000
4
1.2
true
4,970,489
0
0
1
2
Using the development server, it works with debug=True or False. In production, everything works if debug=True, but if debug=False, I get a 500 error and the apache logs end with an import error: "ImportError: cannot import name Project". Nothing in the import does anything conditional on debug - the only code that doe...
Materialize data from cache table to production table [PostgreSQL]
4,973,738
1
0
611
1
python,postgresql,triggers,materialized-views
The "best" solution according to the criteria you've laid out so far would just be to insert into the production table. ...unless there's actually something extremely relevant you're not telling us
0
0
0
0
2011-02-11T19:46:00.000
1
0.197375
false
4,973,316
0
0
1
1
I am trying to find the best solution (perfomance/easy code) for the following situation: Considering a database system with two tables, A (production table) and A'(cache table): Future rows are added first into A' table in order to not disturb the production one. When a timer says go (at midnight, for example) rows f...
Python / Django - Organizing Stylesheets and Scripts
4,974,601
5
1
1,218
0
python,django,django-templates,stylesheet
Look at the django.contrib.admin application. Parallel the way the admin site works. Create a media directory. Create media/img, media/jss, media/css, media/whatever directories In each of these, you'll have your app's specific stuff. media/img/app1, media/jss/app1 so that each of your Django apps can have specific ...
0
0
0
0
2011-02-11T22:02:00.000
4
0.244919
false
4,974,544
0
0
1
1
I am looking for a simple way to organize stylesheets and scripts in Django. I am relatively new to the framework and language of python. I'm coming from a PHP background. In the world of PHP / Zend there are functions that are implemented with the view/layout object. By including a single line inside your head tag ...
Use paste.deploy to serve a twisted application
5,240,896
0
1
306
0
python,twisted,wsgi
It is extremely unlikely that trying to do this is going to be worth the effort. paster serve has it's own event loop, threadpool, etc. and Twisted apps expect something quite different. You could try writing your own paster subcommand, but you're probably better off writing a .tac file that serves both apps for use w...
0
0
0
0
2011-02-11T23:18:00.000
1
0
false
4,975,028
0
0
1
1
I'm working on a project that has two parts: A WSGI-enabled web app written with pylons and served with python-paste A python-twisted application that has nothing to do with HTTP or WSGI. I'd like to keep the configuration for both apps in the same configuration file. I'd also like to use paste serve to launch both t...
receive data from a python program to animate an object on a webpage
4,979,028
0
0
614
0
python,html
Images are not shown "on your website", they are shown "in your users' browsers". The browser needs to request the animation information from your website, which needs to request it from (wherever it comes from). Ideally, the website will cache the data so that 20 browser requests result in just one website request. H...
0
0
1
0
2011-02-12T16:01:00.000
2
0
false
4,979,005
0
0
1
1
good day stackoverflow! im not sure if any of you has tried this but basically i want to accomplish something like this: - a python program continuously sends data to my website - using that data computations will be made and images on the website are animate so my questions are: 1. what method should i use to communic...
web2py and DB transactions
5,443,158
1
2
1,224
1
python,web2py
you can call db.commit() and db.rollback() pretty much everywhere. If you do not and the action does not raise an exception, it commits before returning a response to the client. If it raises an exception and it is not explicitly caught, it rollsback.
0
0
0
0
2011-02-12T17:14:00.000
2
0.099668
false
4,979,392
0
0
1
1
When exactly the database transaction is being commited? Is it for example at the end of every response generation? To explain the question: I need to develop a bit more sophisticated application where I have to control DB transactions less or more manually. Especialy I have to be able to design a set of forms with som...
How to pass data from Java applet to client side python script?
4,981,088
1
0
969
0
java,javascript,python
If you go for JavaScript I'm assuming it would run in a browser and therefore to communicate with anything else it would make HTTP requests (e.g. POST or GET URLs), so the client/server arrangement is unavoidable. Therefore you would need to turn your Python code into a web application, using something like CherryPy to...
0
0
0
0
2011-02-12T21:10:00.000
2
0.099668
false
4,980,657
0
0
1
1
I have a python script which does various number-crunching jobs and now need to put a graphical front-end on it (a molecular editor in which a user draws a compound to pass to the script) to allow others in the lab to use it more easily. The available editors are Java applets, standalone Java or written in JavaScript....
I'm learning python and am interested in using it for web-scripting. What frameworkes are out there and do I need one?
4,980,831
2
1
553
0
python,web,web-frameworks,web-scripting
The Python web frameworks have nothing to do with GUIs, and can all be used via the terminal. The benefits of a framework, as you say, are all to do with making your life easier by supplying the components you need to build a website: the main ones are database interaction through an ORM, a templating system, and URL ...
0
0
0
1
2011-02-12T21:30:00.000
4
1.2
true
4,980,756
0
0
1
2
I've been learning python for use in ArcGIS and some other non-web applications. However, now that I've taken on building a personal website I am interested in using it for web development (as it is the only scripting language I currently know). I've noticed that there are a lot of these things called "frameworks", suc...
I'm learning python and am interested in using it for web-scripting. What frameworkes are out there and do I need one?
4,981,185
0
1
553
0
python,web,web-frameworks,web-scripting
Personnally, I don't use any framework, I write either from scratch on BaseHTTPServer, or using WSGI (with mod_wsgi). It is a bit long to write the skeleton, but I think it is faster (I mean at runtime), there is less constraints, and there is lesser to learn.
0
0
0
1
2011-02-12T21:30:00.000
4
0
false
4,980,756
0
0
1
2
I've been learning python for use in ArcGIS and some other non-web applications. However, now that I've taken on building a personal website I am interested in using it for web development (as it is the only scripting language I currently know). I've noticed that there are a lot of these things called "frameworks", suc...
I found that I'm trying to write an web app behaves exactly like the django admin. What should I do?
4,982,462
2
1
86
0
python,django
That depends on your motivation. If this is an exercise in sharpening yourself then I suggest reinventing it. Mainly because you learn so much in the process. If the main goal is just to have the functionality then use the django-admin and bolt on whatever you need that it lacks.
0
0
0
0
2011-02-13T04:41:00.000
1
1.2
true
4,982,459
0
0
1
1
This may seem quite a weird question but I'm quite confused right now and don't know what to do. I'm working on an intranet web app using django. Soon I found that almost all features I need are done in django-admin, like adding and editing entries, view and filter items in a list view and so on. The missing parts can ...
Need help parsing html in python3, not well formed enough for xml.etree.ElementTree
4,983,230
4
4
1,545
0
python,parsing,python-3.x,xml.etree
The mismatched tag errors are likely caused by mismatched tags. Browsers are famous for accepting sloppy html, and have made it easy for web page coders to write badly formed html, so there's a lot of it. THere's no reason to believe that creagslist should be immune to bad web page designers. You need to use a gramm...
0
0
1
0
2011-02-13T08:29:00.000
3
0.26052
false
4,983,203
0
0
1
1
I keep getting mismatched tag errors all over the place. I'm not sure why exactly, it's the text on craigslist homepage which looks fine to me, but I haven't skimmed it thoroughly enough. Is there perhaps something more forgiving I could use or is this my best bet for html parsing with the standard library?
What's a safe way to do one-off initialization in Django/mod_wsgi?
4,988,044
2
2
1,280
0
python,django,multithreading,initialization,mod-wsgi
I have my initialization code in a middleware that is called when the first request is served. After the initialization is done, you can raise a MiddlewareNotinuse exception, which causes Django not to execute that middleware again. Remember that because of the way apache and http work, no code will be executed before ...
0
0
0
0
2011-02-13T21:26:00.000
3
1.2
true
4,986,986
1
0
1
2
I'm building a Django app that is designed to be multithreaded but reside in a single process running under mod_wsgi. At start of day I need to do various, possibly-lengthy, initialization tasks such as loading a cache of data from the database into a quick lookup dict. I need the intialization to run exactly once be...
What's a safe way to do one-off initialization in Django/mod_wsgi?
4,987,126
0
2
1,280
0
python,django,multithreading,initialization,mod-wsgi
Maybe an good old lockfile is a solution for this problem. Not a really elegant solution, but it saves you a lot of headaches in a multithreaded environment.
0
0
0
0
2011-02-13T21:26:00.000
3
0
false
4,986,986
1
0
1
2
I'm building a Django app that is designed to be multithreaded but reside in a single process running under mod_wsgi. At start of day I need to do various, possibly-lengthy, initialization tasks such as loading a cache of data from the database into a quick lookup dict. I need the intialization to run exactly once be...
PyRSS2Gen and embedding html in description tag
5,024,582
0
0
578
0
python,rss,cdata
I looked into my problem some more and the problem is that PyRSS2Gen uses python's sax library, which has no concept of CDATA, at least when writing out XML. My solution was just to drop PyRSS2Gen and directly use minidom, which does understand CDATA sections. That did mean some extra lines of code. Once the html text...
0
0
0
0
2011-02-13T21:58:00.000
2
1.2
true
4,987,182
0
0
1
1
I want to format the content of the description using html tags. When I try to enclose the content in <![CDATA[content<p>here]]> it doesn't work properly, as it escapes some of the brackets, displaying O.K. in some RSS viewers, but displaying the ]]> in others. If I try to avoid the CDATA and use escaped characters th...
why doesn't eclipse-python have magic refactor?
5,358,618
1
4
1,299
0
javascript,python,eclipse,refactoring,automated-refactoring
so it turns out that tracing of static information like methods and class hierarchies is perfectly possible in python. PyDev eclipse plugin does it. PyLint plugin attempts to do static analysis even on stuff like dynamic variables by assuming that nothing funky happens at runtime and does a pretty good job.
0
0
0
1
2011-02-14T18:28:00.000
2
1.2
true
4,995,842
1
0
1
1
Eclipse is able to utilize compiled bytecode to enable "magic refactor" functionality--renaming methods, tracing up and down class hierarchies and tracing through method calls. What technical barriers exist that make this harder to do for languages like Python and Javascript?
mod_wsgi for Django on Mac OSX 10.5.8
4,997,873
0
1
407
0
python,django,apache,deployment,mod-wsgi
There is no problem running mod_wsgi on OSX 10.5, a precompiled binary isn't supplied that is all. You would need to compile it from source code, meaning you would need to have XCode installed. Otherwise you wait a week until I get home and I will build a mod_wsgi.so for OSX 10.5 and I will put it up for download. Post...
0
0
0
0
2011-02-14T21:16:00.000
3
0
false
4,997,366
0
0
1
2
I'm a newbie learning Django, and couldn't get the development server accessible externally. So I'm looking into other deployment options. It seems that mod_wsgi is the way to go (with Apache), but it only supports OSX 10.6+. Are there any alternatives if you own 10.5.8?
mod_wsgi for Django on Mac OSX 10.5.8
5,012,507
0
1
407
0
python,django,apache,deployment,mod-wsgi
Gunicorn is the fastest way to having a production ready web server serving your site that I've found in the Django realm. It is a Python WSGI HTTP Server for UNIX. Steps involved to deploy your site using gunicorn: pip install gunicorn Add 'gunicorn' your installed apps listed in settings.py ./manage.py run_gunicor...
0
0
0
0
2011-02-14T21:16:00.000
3
0
false
4,997,366
0
0
1
2
I'm a newbie learning Django, and couldn't get the development server accessible externally. So I'm looking into other deployment options. It seems that mod_wsgi is the way to go (with Apache), but it only supports OSX 10.6+. Are there any alternatives if you own 10.5.8?
Log Into Website and Scrape Streaming Data
4,999,545
3
0
1,502
0
python,screen-scraping
If the data "refreshes before your eyes" it is probably AJAX (javascript in the page pulling new page-data from the server). There are two ways of approaching this; using Selenium you can wrap an actual browser which will load the page, run the javascript, then you can grab page-bits from the active page. you can look...
0
0
1
0
2011-02-15T02:52:00.000
2
1.2
true
4,999,485
0
0
1
1
I am not really a programmer but am asking this out of general curiosity. I visited a website recently where I logged in, went to a page, and without leaving, data on that page refreshes before my eyes. Is it possible to mimic a browser (I was using Chrome) and log into the site, navigate to a page, and "scrape" that ...
Why is Jython much slower than CPython, despite the JVM's advances?
5,000,542
25
42
17,795
0
python,jvm,jython
Keep in mind that IronPython was started by one of the original Jython devs (Jim Huginin) in an attempt to prove that the .NET CLR was a poor platform for dynamic languages. He ended up proving himself wrong and the core of IronPython eventually became the .NET Dynamic Language Runtime (making other dynamic language im...
0
0
0
1
2011-02-15T05:55:00.000
1
1.2
true
5,000,360
1
0
1
1
No flame wars please. I am admittedly no fan of Java, but I consider the JVM to be a fairly decent and well-optimized virtual machine. It's JIT-enabled and very close to the common denominator of the prevalent CPU architectures. I'd assume that the CPython runtime would be farther from the metal than a corresponding JV...
Can I deploy Python .pyc files only to Google App Engine?
5,002,563
0
2
2,724
0
python,django,google-app-engine,pyc
Why would you want to do that in the first place? Because your .py files are uploaded to Google infrastructure and can be seen only if you explicitly give permissions. But yes, there is no reason as why uploading only .pyc files should not work. If you try it, in your dev environment, you will find it working just as B...
0
1
0
0
2011-02-15T10:00:00.000
3
0
false
5,002,150
0
0
1
2
I'm working on a project utilizing Django on Google App Engine. I've been asked if some of the code can be deployed as compiled only. So I guess the question is can I upload a .pyc file only that contains the piece of code in question? I've done a basic test with a views.pyc file in an application and things don't wo...
Can I deploy Python .pyc files only to Google App Engine?
5,002,914
7
2
2,724
0
python,django,google-app-engine,pyc
No, you can't - you can only upload sourcecode. There's no good reason to do this, though: your code will be bytecode-compiled on the servers when needed, and nobody is able to access your code in any case.
0
1
0
0
2011-02-15T10:00:00.000
3
1
false
5,002,150
0
0
1
2
I'm working on a project utilizing Django on Google App Engine. I've been asked if some of the code can be deployed as compiled only. So I guess the question is can I upload a .pyc file only that contains the piece of code in question? I've done a basic test with a views.pyc file in an application and things don't wo...
Python web-scraping threaded performance
5,462,848
0
2
929
0
python,automated-tests,web-scraping,urllib2,mechanize-python
I actually went without using mechanize and used the Threading module. This allowed for fairly quick transactions, and I also made sure not to have too much inside of each thread. Login information, and getting the webapp in the state necessary before I threaded helped the threads to run shorter and therefore more quic...
0
0
0
1
2011-02-15T11:22:00.000
3
1.2
true
5,002,986
0
0
1
2
I have a web app that needs both functionality and performance tested, and part of the test suite that we plan on using is already written in Python. When I first wrote this, I used mechanize as my means of web-scraping, but it seems to be too bulky for what I'm trying to do (either that or I'm missing something). The ...
Python web-scraping threaded performance
5,236,735
0
2
929
0
python,automated-tests,web-scraping,urllib2,mechanize-python
Have you considered Twisted, the asynchronous library, for at least doing interaction with users?
0
0
0
1
2011-02-15T11:22:00.000
3
0
false
5,002,986
0
0
1
2
I have a web app that needs both functionality and performance tested, and part of the test suite that we plan on using is already written in Python. When I first wrote this, I used mechanize as my means of web-scraping, but it seems to be too bulky for what I'm trying to do (either that or I'm missing something). The ...
sqlautocode : primary key required in tables?
5,292,555
0
0
321
1
python,web-applications,turbogears,turbogears2
We've succeeded in faking sqa if the there's combination of columns on the underlying table that uniquely identify it. If this is your own table and you're not live, add a primary key integer column or something. We've even been able to map an existing legacy table in a database with a) no pk and b) no proxy for a prim...
0
0
0
0
2011-02-15T12:11:00.000
3
0
false
5,003,475
0
0
1
3
This relates to primary key constraint in SQLAlchemy & sqlautocode. I have SA 0.5.1 & sqlautocode 0.6b1 I have a MySQL table without primary key. sqlautocode spits traceback that "could not assemble any primary key columns". Can I rectify this with a patch sothat it will reflect tables w/o primary key? Thanks, Vineet D...
sqlautocode : primary key required in tables?
5,292,729
0
0
321
1
python,web-applications,turbogears,turbogears2
If the problem is that sqlautocode will not generate your class code because it cannot determine the PKs of the table, then you would probably be able to change that code to fit your needs (even if it means generating SQLA code that doesn't have PKs). Eventually, if you're using the ORM side of SQLA, you're going to ne...
0
0
0
0
2011-02-15T12:11:00.000
3
0
false
5,003,475
0
0
1
3
This relates to primary key constraint in SQLAlchemy & sqlautocode. I have SA 0.5.1 & sqlautocode 0.6b1 I have a MySQL table without primary key. sqlautocode spits traceback that "could not assemble any primary key columns". Can I rectify this with a patch sothat it will reflect tables w/o primary key? Thanks, Vineet D...
sqlautocode : primary key required in tables?
5,003,573
0
0
321
1
python,web-applications,turbogears,turbogears2
I don't think so. How an ORM is suposed to persist an object to the database without any way to uniquely identify records? However, most ORMs accept a primary_key argument so you can indicate the key if it is not explicitly defined in the database.
0
0
0
0
2011-02-15T12:11:00.000
3
0
false
5,003,475
0
0
1
3
This relates to primary key constraint in SQLAlchemy & sqlautocode. I have SA 0.5.1 & sqlautocode 0.6b1 I have a MySQL table without primary key. sqlautocode spits traceback that "could not assemble any primary key columns". Can I rectify this with a patch sothat it will reflect tables w/o primary key? Thanks, Vineet D...
Post-process request event in Pyramid/Pylons
5,011,293
1
3
1,412
0
python,pylons,pyramid
In Pylons, each controller can have a before and after methods you can define that's then called before/after the controller method called. There's also the lib/base.py file which contains the controller call and you could add some custom code there, but it will be called on every request and can be dangerous if your ...
0
0
0
0
2011-02-15T23:45:00.000
2
0.099668
false
5,010,863
0
0
1
1
Is there an event or some kind of work with middlelayer where the request is already sent to the user, but we still have the information so we can do stuff on the DB later?
Managing two instances of the same GAE application
5,012,278
1
2
74
0
python,google-app-engine
Assuming you are avoiding Nick's suggestion for some particular reason, the next best thing would be to include the copying process in your build system. 1 When you build your deploy target, maven/make/ant/"your favorite build tool" should check out copies of your latest revision from your source control system into s...
0
1
0
0
2011-02-15T23:52:00.000
3
0.066568
false
5,010,906
0
0
1
1
I have an GAE app, and I deploy it on 2 different domains, and they use separate datastores. However, right now it is done by having two identical folders with different app.yaml configurations. If I make changes I need to copy all files again. Is there an elegant solution for that, like having two app.yaml files in t...
2011 Web Scripting Languages and Dynamic Reloading
5,014,150
4
5
368
0
php,python,ruby,groovy,reloading
I think you're making a bigger deal out of this than it really is. Any application for which it is that important that it never be down for 1/2 a minute (which is all it takes to reboot a server to pick up a file change) really needs to have multiple application server instances in order to handle potential failures of...
0
0
0
1
2011-02-16T07:56:00.000
2
0.379949
false
5,013,863
0
0
1
1
This has been bugging me for awhile now. In a deployed PHP web application one can upload a changed php script and have the updated file picked up by the web server without having to restart. The problem? Ruby, Groovy, & Python, etc. are all "better" than PHP in terms of language expressiveness, concision, power, ......
Can my django app act as a header-stripping proxy?
5,014,850
0
2
347
0
python,django,proxy,mp3,soundcloud
I don't think it's possible. It should already be entirely up to the browser. For example Opera asks user weather to open it or download. You could embed them in your site using their Embeded Code. EDIT: Nope you can't even use the link provided by the header since they've worked around hotlinking. Each download is ass...
0
0
0
0
2011-02-16T09:08:00.000
2
0
false
5,014,485
0
0
1
2
Public Soundcloud track urls force a download upon browsing to them by utilizing a Content-Disposition header (I think.. ) which triggers a download for a known mime-type. Is there a way to proxy (create a passthrough for) these urls and strip this header from my request. I want to avoid serving the mp3 myself but I d...
Can my django app act as a header-stripping proxy?
5,038,974
2
2
347
0
python,django,proxy,mp3,soundcloud
Technically it is entirely possible that you could request the file from the server and connect that incoming data to an output stream response in your view, thereby allowing you to control the headers that your client's browser receives so that it does not ask them to save the file. I'm going to recommend against this...
0
0
0
0
2011-02-16T09:08:00.000
2
1.2
true
5,014,485
0
0
1
2
Public Soundcloud track urls force a download upon browsing to them by utilizing a Content-Disposition header (I think.. ) which triggers a download for a known mime-type. Is there a way to proxy (create a passthrough for) these urls and strip this header from my request. I want to avoid serving the mp3 myself but I d...
Unicode conversion error with django
5,014,866
2
0
267
0
python,django
Check your .po files, in particular the one for the current language; the encoding may be declared incorrectly.
0
0
0
0
2011-02-16T09:46:00.000
1
1.2
true
5,014,847
0
0
1
1
Hi I've upgraded my django version to 1.2.5 and my app stopped working. The error I'm getting now is as follows: Caught DjangoUnicodeDecodeError while rendering: 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128). You passed in () So far I've been unsuccessful in debugging this p...
Non-blocking http server , java nio , python tornado eventlet
5,049,188
4
4
2,292
0
java,python,http,asynchronous,nonblocking
Nonblocking servers are the best choice provided all your libraries provides nonblocking apis. As mentioned in your second question if a library blocks (eg database lib making a blocking call), the entire process/thread blocks and the system hangs. Not all of the libraries available are asynchronous which makes it dif...
0
1
0
1
2011-02-17T06:31:00.000
1
0.664037
false
5,025,770
0
0
1
1
Hi I am trying to Understand if tornado/eventlet based http sever are better than threaded sever. While goggling the subject I am seeing that these are single thread event base server which run a single handler function after select/poll/epoll on socket. My first question is that is this tornado/eventlet similar to n...
Google App Engine log username with custom auth
5,035,952
0
1
252
0
python,google-app-engine,logging
Add a single logging.debug call in your authentication code to log the current user. Logs are shown aggregated by request, so you'll always be able to see the user associated with that request.
0
1
0
0
2011-02-17T09:56:00.000
1
0
false
5,027,371
0
0
1
1
I use a custom authentication for my python Google App Engine app. There is a "username" field in the log for every request, which is empty now. Is it possible to add the name of the authenticated user to the log? I would not like to add an "user: %s" % user.name manually to all of my logging.xxx statements. Thanks.
How to set choices in dynamic with Django choicefield?
5,038,378
-1
9
13,979
0
python,django
Similar to maersu's solution, but if you have a ModelForm with a model that has a ForeignKey to another model, you may want to assign to the field's queryset instead of choices.
0
0
0
0
2011-02-17T12:09:00.000
4
-0.049958
false
5,028,731
0
0
1
1
I want to set choices in dynamic. I used __set_choices method but, when request method is POST, is_valid method always return False. if request.method=='POST': _form = MyForm(request.POST) if _form.is_valid(): #something to do
What's the best way to optimise the fixture-loading part of Django tests?
5,029,483
4
9
1,206
0
python,django,testing,performance,fixtures
You may use sqlite in-memory database for tests - it really fast
0
0
0
1
2011-02-17T13:16:00.000
2
0.379949
false
5,029,415
0
0
1
2
my Django tests run really slowly, but it's not the test's fault. At the moment, the whole process takes 14s, but only 0.1s of that is running tests. The first few seconds are creating tables & indexes, the rest is applying the project's many fixtures. What's the best way to deal with this? I think there is a way of sp...
What's the best way to optimise the fixture-loading part of Django tests?
5,029,700
4
9
1,206
0
python,django,testing,performance,fixtures
"but I need most of them to do most tests"... Sorry about this, but to speed things up you're going to have to do some thinking. "I think there is a way of specifying which fixtures to load in each test" This is a disturbing thing to read. Have you looked at your tests recently? Your tests do -- specifically ...
0
0
0
1
2011-02-17T13:16:00.000
2
1.2
true
5,029,415
0
0
1
2
my Django tests run really slowly, but it's not the test's fault. At the moment, the whole process takes 14s, but only 0.1s of that is running tests. The first few seconds are creating tables & indexes, the rest is applying the project's many fixtures. What's the best way to deal with this? I think there is a way of sp...
Django manage.py only returning list of subcommands and options
5,032,229
1
0
1,622
0
python,django,manage.py
have you run manage.py runserver and if you have, then try python manage.py runserver?
0
0
0
0
2011-02-17T17:08:00.000
1
1.2
true
5,032,139
0
0
1
1
I'm sure I'm overlooking something very simple, but I've tried multiple times and still run into the same problem. I have installed Python 2.7.1 and Django 1.2.4 on Windows Vista. I create a project using django-admin startproject projectname. It successfully creates the folders and files needed. I then try running man...
In Django, a way for user to upload file to server, then move to Amazon S3?
5,035,338
1
1
714
0
python,django,amazon-s3,wav,waveform
It would make sense to do the work on your side and then upload to Amazon S3. You should be able to use Boto, or any other library by importing the library.
0
0
0
0
2011-02-17T21:59:00.000
2
0.099668
false
5,035,203
0
0
1
1
I have a web project where users are uploading .wav files. I want to generate a waveform image from the .wav file once it's uploaded. But generally for storage, I want to use Amazon S3. Thing is, I want to use something like TimeSide (http://code.google.com/p/timeside/wiki/PythonApi) to generate the waveform image from...
Designing a Django voting system without using accounts
5,036,260
4
6
1,261
0
python,django,django-forms,django-authentication,voting
To address your concerns: 1: a simple Captcha would probably do the trick, if you google "django captcha", there are a bunch of plugins. I've never used them myself, so I can't say which is the best. 2 & 3: Using Django's sessions addresses both of these problems - with it you could save a cookie on the user's browse...
0
0
0
0
2011-02-17T22:14:00.000
2
1.2
true
5,035,348
0
0
1
1
We are considering implementing a voting system (up, down votes) without using any type of credentials--no app accounts nor OpenID or anything of that sort. Concerns in order: Prevent robot votes Allow individuals under a NAT to vote without overriding/invalidating someone else's vote Preventing (or, at the very least...
Can SQLAlchemy do a non-destructive alter of the db comparing the current model with db schema?
5,037,471
0
0
220
1
python,orm,sqlalchemy
Sqlalchemy-migrate (http://packages.python.org/sqlalchemy-migrate/) is intended to help do these types of operations.
0
0
0
0
2011-02-17T23:44:00.000
1
0
false
5,036,118
0
0
1
1
Basically I'm looking for an equivalent of DataMapper.auto_upgrade! from the Ruby world. In other words: change the model run some magic -> current db schema is investigated and changed to reflect the model profit Of course, there are cases when it's impossible for such alteration to be non-desctructive, eg. when you...
Scrapy: RSS control pub_date
12,648,771
0
0
231
0
python,web-crawler,scrapy
I store all data in database as well, and calculate a hash value out of the data. That way you can look up the hash very quickly, and carry out de-dup operation on the fly.
0
0
1
0
2011-02-18T10:50:00.000
2
0
false
5,040,388
0
0
1
2
I'm doing a RSS spider. How do you do for controlling the last crawl date? Right now what was I thinking is this: Put in a control file the last pub_date that I have crawled. Then when the crawl starts, it checks the last pub_date against the new pub_dates. If there are new items, then start crawling, if not, do noth...
Scrapy: RSS control pub_date
5,042,647
1
0
231
0
python,web-crawler,scrapy
I store all data in the database (including last crawl date and post dates) and take all dates I need from database.
0
0
1
0
2011-02-18T10:50:00.000
2
0.099668
false
5,040,388
0
0
1
2
I'm doing a RSS spider. How do you do for controlling the last crawl date? Right now what was I thinking is this: Put in a control file the last pub_date that I have crawled. Then when the crawl starts, it checks the last pub_date against the new pub_dates. If there are new items, then start crawling, if not, do noth...
Chrome extension in python?
9,693,740
7
49
65,662
0
python,google-chrome-extension
Although you mentioned you don't want it to be a hosted app, but this is one typical scenario where a hosted app can do. SciPy is not a package that is easy to deploy. Even if you are writing a installed application based on SciPy, it requires some effort to deploy this dependency. A web application can help here wher...
0
0
1
0
2011-02-19T02:23:00.000
7
1
false
5,048,436
0
0
1
1
I would like to create a google chrome extension. Specifically, I'd like to make a packaged app, but not a hosted app. Am I correct in thinking this limits me to JavaScript (and HTML/CSS)? My problem is that I need to do some complex math (singular value decomposition, factor analysis) and I don't want to write algorit...