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
Update App Engine Tasks?
11,308,295
1
2
294
0
python,google-app-engine,task-queue
With pull queues, you can use modify_task_lease to set the ETA relative to the current time (even if you do not currently have the task leased). You can't change the ETA of a pull queue task. Each task's name remains unavailable for seven days.
0
1
0
0
2012-07-03T04:53:00.000
2
0.099668
false
11,304,679
0
0
1
2
Is it possible to update an AppEngine task in the task queue? Specifically, changing the eta property of the task to make it run at a different time? In my scenario, each item in my datastore has an associated task attached to it. If the element is updated, the task needs to updated with a new eta. I currently set the name of the task explicitly as the id of the item using name=item.key().id() so that I can uniquely refer to the task. When the task is called and deleted, the name doesn't get freed immediately (I think). This causes issues because I need to re-add the task as soon as it gets executed.
Update App Engine Tasks?
11,313,223
1
2
294
0
python,google-app-engine,task-queue
So I resolved this in the following way: I created an entry in my Model for a task_name. When I create the element and add a new task, I allow app engine to generate an automated, unique name for the task then retrieve the name of that task and save it with the model. This allows me to have that reference to the task. When I need to modify the task, I simply delete the existing one, create a new one with the new eta and then save the new task's name to the model. This is working so far, but there might be issues in the future regarding tasks not being consistent when the Task.add() function returns.
0
1
0
0
2012-07-03T04:53:00.000
2
1.2
true
11,304,679
0
0
1
2
Is it possible to update an AppEngine task in the task queue? Specifically, changing the eta property of the task to make it run at a different time? In my scenario, each item in my datastore has an associated task attached to it. If the element is updated, the task needs to updated with a new eta. I currently set the name of the task explicitly as the id of the item using name=item.key().id() so that I can uniquely refer to the task. When the task is called and deleted, the name doesn't get freed immediately (I think). This causes issues because I need to re-add the task as soon as it gets executed.
error in accessing table created in django in the python code
11,308,029
1
1
768
1
python,django,linux,sqlite,ubuntu-10.04
The exception says: no such table: search_keywords, which is quite self-explanatory and means that there is no database table with such name. So: You may be using relative path to db file in settings.py, which resolves to a different db depending on place where you execute the script. Try to use absolute path and see if it helps. You have not synced your models with the database. Run manage.py syncdb to generate the database tables.
0
0
0
0
2012-07-03T09:18:00.000
1
1.2
true
11,307,928
0
0
1
1
Now on writing path as sys.path.insert(0,'/home/pooja/Desktop/mysite'), it ran fine asked me for the word tobe searched and gave this error: Traceback (most recent call last): File "call.py", line 32, in s.save() File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 463, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 524, in save_base manager.using(using).filter(pk=pk_val).exists())): File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 562, in exists return self.query.has_results(using=self.db) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 441, in has_results return bool(compiler.execute_sql(SINGLE)) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py", line 818, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py", line 40, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py", line 337, in execute return Database.Cursor.execute(self, query, params) django.db.utils.DatabaseError: no such table: search_keywords Please help!!
Efficent way to calculate Top 10, or Top X, list, across multiple time periods
11,317,758
1
1
275
0
python,django,sorting,time-complexity,aggregation
The short answer is No. There is no guarantee that a Top-Ten-Of-Last-Year song was ever on a Top-Ten-Daily list (it's highly likely, but not guaranteed). The only way to get an absolutely-for-sure Top Ten is to add up all the votes over the specified time period, then select the Top Ten.
0
0
0
0
2012-07-03T18:18:00.000
3
1.2
true
11,316,815
0
0
1
2
What I want to do: Calculate the most popular search queries for: past day, past 30 days, past 60 days, past 90 days, each calendar month, and for all time. My raw data is a list of timestamped search queries, and I'm already running a nightly cron job for related data aggregation so I'd like to integrate this calculation into it. Reading through every query is fine (and as far as I can tell necessary) for a daily tally, but for the other time periods this is going to be an expensive calculation so I'm looking for a way to use my precounted data to save time. What I don't want to do: Pull the records for every day in the period, sum all the tallies, sort the entire resulting list, and take the top X values. This is going to be inefficient, especially for the "all time" list. I considered using heaps and binary trees to keep realtime sorts and/or access data faster, reading words off of each list in parallel and pushing their values into the heap with various constraints and ending conditions, but this always ruins either the lookup time or the sort time and I'm basically back to looking at everything. I also thought about keeping running totals for each time period, adding the latest day and subtracting the earliest (saving monthly totals on the 1st of every month), but then I have to save complete counts for every time period every day (instead of just the top X) and I'm still looking through every record in the daily totals. Is there any way to perform this faster, maybe using some other data structure or a fun mathematical property that I'm just not aware of? Also, tn case anyone needs to know, this whole thing lives inside a Django project.
Efficent way to calculate Top 10, or Top X, list, across multiple time periods
11,317,049
0
1
275
0
python,django,sorting,time-complexity,aggregation
Could use the Counter() class, part of the high-performance container datatypes. Create a dictionary of all the searches as keys to the dictionary with a count of their frequency. cnt = Counter() for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']: cnt[word] += 1 print cnt Counter({'blue': 3, 'red': 2, 'green': 1})
0
0
0
0
2012-07-03T18:18:00.000
3
0
false
11,316,815
0
0
1
2
What I want to do: Calculate the most popular search queries for: past day, past 30 days, past 60 days, past 90 days, each calendar month, and for all time. My raw data is a list of timestamped search queries, and I'm already running a nightly cron job for related data aggregation so I'd like to integrate this calculation into it. Reading through every query is fine (and as far as I can tell necessary) for a daily tally, but for the other time periods this is going to be an expensive calculation so I'm looking for a way to use my precounted data to save time. What I don't want to do: Pull the records for every day in the period, sum all the tallies, sort the entire resulting list, and take the top X values. This is going to be inefficient, especially for the "all time" list. I considered using heaps and binary trees to keep realtime sorts and/or access data faster, reading words off of each list in parallel and pushing their values into the heap with various constraints and ending conditions, but this always ruins either the lookup time or the sort time and I'm basically back to looking at everything. I also thought about keeping running totals for each time period, adding the latest day and subtracting the earliest (saving monthly totals on the 1st of every month), but then I have to save complete counts for every time period every day (instead of just the top X) and I'm still looking through every record in the daily totals. Is there any way to perform this faster, maybe using some other data structure or a fun mathematical property that I'm just not aware of? Also, tn case anyone needs to know, this whole thing lives inside a Django project.
How to install the Django plugin for the Eric IDE?
11,370,886
4
0
4,909
0
python,django,ide,eric-ide
In the Plugins dropdown menu click on Plugin repository... Make sure that the repository URL is: http://eric-ide.python-projects.org/plugins4/repository.xml and then click on update. The Django plugin will show up in the list of available plugins, click on it and then click the download button. That should download the plugin for you. After that you need to actually install the plugin as well: In the Plugins dropdown menu click on Install plugins. Then select your newly downloaded Django plugin and install it. Good luck!
0
0
0
0
2012-07-03T21:01:00.000
2
0.379949
false
11,319,116
0
0
1
1
I can't believe I have to ask this, but I have spent almost three hours looking for the answer. Anyway, I have Eric IDE 4 installed on my linux distro. I can't seem to download any plugins to the plugins repository. The only one I really want is the Django plugin so when I start a new project in Eric, the Django option shows. The plugin repository just shows me an empty folder for .eric4/eric4plugins and there's no follow up as to where I can get the plugins from somewhere else. Actually, there was a hinting at it on the Eric docs site, but what I ended up getting was the ENTIRE trunk for eric. And the plugins that came with the trunk are just the bare bones ones that ship with it. I didn't get the Django one and the documentation on the Eric site is seriously lacking and overly complex. Anyone know how I can just get the Django snap in?
key/value store with good performance for multiple tenants
11,319,983
0
1
239
1
javascript,python,google-app-engine,nosql,multi-tenant
The overhead of making calls from appengine to these external machines is going to be worse than the performance you're seeing now (I would expect). why not just move everything to a non-appengine machine? I can't speak for couch, but mongo or redis are definitely capable of handling serious load as long as they are set up correctly and with enough horsepower for your needs.
0
1
0
0
2012-07-03T22:08:00.000
2
0
false
11,319,890
0
0
1
2
im running a multi tenant GAE app where each tenant could have from a few 1000 to 100k documents. at this moment im trying to make a MVC javascript client app (the admin part of my app with spine.js) and i need CRUD endpoints and the ability to get a big amount of serialized objects at once. for this specific job appengine is way to slow. i tried to store serialized objects in the blobstore but between reading/writing and updating stuff to the blobstore it takes too much time and the app gets really slow. i thought of using a nosql db on an external machine to do these operations over appengine. a few options would be mongodb, couchdb or redis. but i am not sure about how good they perform with that much data and concurrent requests/inserts from different tenants. lets say i have 20 tenants and each tenant has 50k docs. are these dbs capable to handle this load? is this even the right way to go?
key/value store with good performance for multiple tenants
11,323,377
2
1
239
1
javascript,python,google-app-engine,nosql,multi-tenant
Why not use the much faster regular appengine datastore instead of blobstore? Simply store your documents in regular entities as Blob property. Just make sure the entity size doesn't exceed 1 MB in which case you have to split up your data into more then one entity. I run an application whith millions of large Blobs that way. To further speed up things use memcache or even in-memory cache. Consider fetching your entites with eventual consistency which is MUCH faster. Run as many database ops in parallel as possible using either bulk operations or the async API.
0
1
0
0
2012-07-03T22:08:00.000
2
1.2
true
11,319,890
0
0
1
2
im running a multi tenant GAE app where each tenant could have from a few 1000 to 100k documents. at this moment im trying to make a MVC javascript client app (the admin part of my app with spine.js) and i need CRUD endpoints and the ability to get a big amount of serialized objects at once. for this specific job appengine is way to slow. i tried to store serialized objects in the blobstore but between reading/writing and updating stuff to the blobstore it takes too much time and the app gets really slow. i thought of using a nosql db on an external machine to do these operations over appengine. a few options would be mongodb, couchdb or redis. but i am not sure about how good they perform with that much data and concurrent requests/inserts from different tenants. lets say i have 20 tenants and each tenant has 50k docs. are these dbs capable to handle this load? is this even the right way to go?
choosing an application framework to handle offline analysis with web requests
11,328,214
0
0
168
0
python,web
Given your background and the analysys code already being written in Python, Django + Celery seems like an obvious candidate here. We're currently using this solution for a very processing-heavy app with one front-end django server, one dedicated database server, and two distinct celery servers for the background processing. Having the celery processes on distinct servers keeps the djangon front responsive whatever the load on the celery servers (and we can add new celery servers if required). So well, I don't know if it's "the most efficient" solution but it does work.
0
0
0
0
2012-07-04T11:02:00.000
1
0
false
11,327,779
0
0
1
1
I am trying to design a web based app at the moment, that involves requests being made by users to trigger analysis of their previously entered data. The background analysis could be done on the same machine as the web server or be run on remote machines, and should not significantly impede the performance of the website, so that other users can also make analysis requests while the background analysis is being done. The requests should go into some form of queueing system, and once an analysis is finished, the results should be returned and viewable by the user in their account. Please could someone advise me of the most efficient framework to handle this project? I am currently working on Linux, the analysis software is written in Python, and I have previously designed dynamic sites using Django. Is there something compatible with this that could work?
Changing a datafield into a database in selenium testcase: django python
11,331,728
0
0
125
0
python,django,django-models,selenium
Selenium API enables you to interact with a web page and various web elements on it. To change any value in your database will have have to do that based on which database you are using and which python methods are using to interact with this database provider. (For eg - one will use JDBC when using Java language) It has nothing to do with selenium or it's API.
0
0
0
0
2012-07-04T12:56:00.000
1
1.2
true
11,329,598
0
0
1
1
There is this field in my database which is package_expiry_date , now I want to change its value from selenium test case itself to use it after a while. like extend the date by 5 days by adding datetime.timedelta(days=5) . How can I change its value in database table, in python selenium testcase for django.
Does python have a tool similar to Java's JPS
11,333,155
1
2
1,045
0
python,process
No. Each Python script has its own independent interpreter, so there is no convenient way to list all Python processes.
0
1
0
0
2012-07-04T17:00:00.000
3
0.066568
false
11,333,061
1
0
1
2
Does Python have a tool to list python processes similar to Java's jps (http://docs.oracle.com/javase/6/docs/technotes/tools/share/jps.html)? Edit: Getting the pid's of python processes is relatively easy (ps -A | grep python). What I am really looking for is a way to query a currently-running python process and find out the python file it was originally executed on. From the JPS docs, "jps will list each Java application's lvmid followed by the short form of the application's class name or jar file name." Basically, is there an easy way to query a bunch of python processes and find out useful information like JPS does for JVMs?
Does python have a tool similar to Java's JPS
12,424,762
1
2
1,045
0
python,process
The best way I've found to get the information I need is using ps -x, which gives the original command line arguments of all running processes.
0
1
0
0
2012-07-04T17:00:00.000
3
1.2
true
11,333,061
1
0
1
2
Does Python have a tool to list python processes similar to Java's jps (http://docs.oracle.com/javase/6/docs/technotes/tools/share/jps.html)? Edit: Getting the pid's of python processes is relatively easy (ps -A | grep python). What I am really looking for is a way to query a currently-running python process and find out the python file it was originally executed on. From the JPS docs, "jps will list each Java application's lvmid followed by the short form of the application's class name or jar file name." Basically, is there an easy way to query a bunch of python processes and find out useful information like JPS does for JVMs?
Python/Django development, windows or linux?
11,339,389
1
19
25,407
0
python,windows,django,linux
I normally use OSX on my desktop, but I use Linux for Python because that's how it will get deployed. Specifically, I use Ubuntu Desktop in a virtual machine to develop Python applications and I use Ubuntu on the server to deploy them. This means that my understanding of library and module requirements/dependencies are 100% transferrable to the server when I'm ready to deploy the application. If I used OSX (or Windows) to develop Python apps I would have to deal with two different methods of handling requirements and dependencies --- it's just too much work. My suggestion: use VMWare Player (it's free) and find a Ubuntu VM to start learning. It's not too complicated and is actually quite fun.
0
1
0
0
2012-07-05T05:43:00.000
5
0.039979
false
11,338,382
0
0
1
2
I have been working on Python quite a lot recently and started reading the doc for Django, however I can't deny the fact that most of the video tutorials I find usually shows Linux as the chosen OS. I've ignored this mostly, but I started to come upon some problems with people using commands such as "touch" for which I have no idea about what the equivalent is in the Windows 7 command prompt. I've heard about New-Item in Power Shell, however it's messy and I am fearing that this "equivalent hunt" might come again and again... So I started to wonder why were most of the people using Linux with Python, would be a good move (knowing that my Linux knowledge is completely null) to learn to use Linux for development purpose? Would it allow me to be more efficient at developing with Python in general? Would it be possible to list the benefits of doing so?
Python/Django development, windows or linux?
11,338,865
27
19
25,407
0
python,windows,django,linux
I used Windows for quite some time for Django development, but finally figured out that Linux is simply the better way to go. Here are some reasons why: some Python packages can not be installed at all or correctly in Windows OR it will create a lot of hassle for you to do so if you need to deploy your Django app it makes more sense to use a Unix-flavored system, simply because its 99% likely that you deployment environment is the same. Doing a dry run on your local machine with the same configuration will save you a lot of time later on + here you are "allowed" to make mistakes. If your apps gets complex its way easier in Linux to get the required dependencies, be it extensions, libraries, etc.. In Windows you end up looking for the right site to download everything and go through some hassle of installation and configuration. It took me lots of time to just search for some specific things sometimes. In Linux its often just an "apt-get" (or similiar) and you are done. Did I mention that everything is faster to get and install in Linux? Of course if your app is simple and you don't need to care about the deployment then Windows is fine.
0
1
0
0
2012-07-05T05:43:00.000
5
1.2
true
11,338,382
0
0
1
2
I have been working on Python quite a lot recently and started reading the doc for Django, however I can't deny the fact that most of the video tutorials I find usually shows Linux as the chosen OS. I've ignored this mostly, but I started to come upon some problems with people using commands such as "touch" for which I have no idea about what the equivalent is in the Windows 7 command prompt. I've heard about New-Item in Power Shell, however it's messy and I am fearing that this "equivalent hunt" might come again and again... So I started to wonder why were most of the people using Linux with Python, would be a good move (knowing that my Linux knowledge is completely null) to learn to use Linux for development purpose? Would it allow me to be more efficient at developing with Python in general? Would it be possible to list the benefits of doing so?
Multiple forms in one page in DJANGO
11,342,225
2
1
543
0
python,django,django-forms
You can make use of AJAX for a single form submission instead of whole page submit.
0
0
0
0
2012-07-05T07:39:00.000
1
0.379949
false
11,339,815
0
0
1
1
I've been developing a django project for 1 month. So I'm new at Django. My current problem with Django is; When I have multiple forms in one page and the page is submitted for a form, the other forms field values are lost. Because they are not posted. I've found a solution for this problem; When there is get method, I send the other forms value with the page url and I can handle them from the get request. When there is post method, I keep the others form fields value in hidden inputs in HTML side in the form which is posted. Hence I can handle it from the post request. Maybe I can keep them in session object. But it may not be good to keep them for whole time which the user logg in. But I dont know. I may have to use this method. Is there another way which is more effective to keep all forms fields in Django? Any Suggestion? Thank!
In plone how can I make an uploaded file as NOT downloadable?
11,350,843
3
1
362
0
python,plone
Cue tune from Hotel California: "You can check out any time you like, but you can never leave." You do not not really want to disable all downloading, I believe that you really just want to disable downloads from all users but Owner. There is no practical use for putting files into something with no vehicle for EVER getting them back out... ...so you need to solve this problem with workflow: Use a custom workflow definition that has a state for this behavior ("Confidential"). Ensure that "View" permission is not inherited from folder above in the permissions for this state, and check "Owner" (and possibly "Manager" if you see fit) as having "View" permission. Set the confidential state as the default state for files. You can do this using Workflow policy support ("placeful workflows") in parts of the site if you do not wish to do this site-wide. Should you wish to make the existence of the items viewable, but the download not, you are best advised to create a custom permission and a custom type to protect downloading with a permission other than "View" (but you still should use workflow state as permission-to-role mapping templates).
0
0
0
0
2012-07-05T09:05:00.000
2
0.291313
false
11,341,112
0
0
1
2
I wish to make the uploaded file contents only viewable on the browser i.e using atreal.richfile.preview for doc/xls/pdf files. The file should not be downloadable at any cost. How do I remove the hyperlink for the template in a particular folder for all the files in that folder? I use Plone 4.1 There is AT at_download.
In plone how can I make an uploaded file as NOT downloadable?
11,355,784
1
1
362
0
python,plone
Script (Python) at /mysite/portal_skins/archetypes/at_download Just customize to contain nothing. Thought this will be helpful to someone who would like to keep files/ image files in Plone confidential by sharing the folders with view permission and disable checkout and copy option for the role created
0
0
0
0
2012-07-05T09:05:00.000
2
1.2
true
11,341,112
0
0
1
2
I wish to make the uploaded file contents only viewable on the browser i.e using atreal.richfile.preview for doc/xls/pdf files. The file should not be downloadable at any cost. How do I remove the hyperlink for the template in a particular folder for all the files in that folder? I use Plone 4.1 There is AT at_download.
BooleanField doesn't work (always checked) in Django 1.4
11,345,396
0
0
652
0
python,django
By default it shows as active i.e checked/True. If you want NULL value as well try using NullBooleanField
0
0
0
0
2012-07-05T13:22:00.000
2
0
false
11,345,236
0
0
1
1
I use BooleanField in my model like this: active = models.BooleanField() During edition in django admin, attribute 'active' is always checked, why?
How can I periodically run a Python script to import data into a Django app?
16,125,317
1
1
3,419
0
python,django,data-importer
I have done the same thing. Firstly, my script was already parsing the emails and storing them in a db, so I set the db up in settings.py and used python manage.py inspectdb to create a model based on that db. Then it's just a matter of building a view to display the information from your db. If your script doesn't already use a db it would be simple to create a model with what information you want stored, and then force your script to write to the tables described by the model.
0
0
0
0
2012-07-05T17:30:00.000
8
0.024995
false
11,349,476
0
0
1
4
I have a script which scans an email inbox for specific emails. That part's working well and I'm able to acquire the data I'm interested in. I'd now like to take that data and add it to a Django app which will be used to display the information. I can run the script on a CRON job to periodically grab new information, but how do I then get that data into the Django app? The Django server is running on a Linux box under Apache / FastCGI if that makes a difference. [Edit] - in response to Srikar's question When you are saying " get that data into the Django app" what exactly do you mean?... The Django app will be responsible for storing the data in a convenient form so that it can then be displayed via a series of views. So the app will include a model with suitable members to store the incoming data. I'm just unsure how you hook into Django to make new instances of those model objects and tell Django to store them.
How can I periodically run a Python script to import data into a Django app?
11,349,554
0
1
3,419
0
python,django,data-importer
When you are saying " get that data into the DJango app" what exactly do you mean? I am guessing that you are using some sort of database (like mysql). Insert whatever data you have collected from your cronjob into the respective tables that your Django app is accessing. Also insert this cron data into the same tables that your users are accessing. So that way your changes are immediately reflected to the users using the app as they will be accessing the data from the same table.
0
0
0
0
2012-07-05T17:30:00.000
8
0
false
11,349,476
0
0
1
4
I have a script which scans an email inbox for specific emails. That part's working well and I'm able to acquire the data I'm interested in. I'd now like to take that data and add it to a Django app which will be used to display the information. I can run the script on a CRON job to periodically grab new information, but how do I then get that data into the Django app? The Django server is running on a Linux box under Apache / FastCGI if that makes a difference. [Edit] - in response to Srikar's question When you are saying " get that data into the Django app" what exactly do you mean?... The Django app will be responsible for storing the data in a convenient form so that it can then be displayed via a series of views. So the app will include a model with suitable members to store the incoming data. I'm just unsure how you hook into Django to make new instances of those model objects and tell Django to store them.
How can I periodically run a Python script to import data into a Django app?
11,349,556
0
1
3,419
0
python,django,data-importer
Best way? Make a view on the django side to handle receiving the data, and have your script do a HTTP POST on a URL registered to that view. You could also import the model and such from inside your script, but I don't think that's a very good idea.
0
0
0
0
2012-07-05T17:30:00.000
8
0
false
11,349,476
0
0
1
4
I have a script which scans an email inbox for specific emails. That part's working well and I'm able to acquire the data I'm interested in. I'd now like to take that data and add it to a Django app which will be used to display the information. I can run the script on a CRON job to periodically grab new information, but how do I then get that data into the Django app? The Django server is running on a Linux box under Apache / FastCGI if that makes a difference. [Edit] - in response to Srikar's question When you are saying " get that data into the Django app" what exactly do you mean?... The Django app will be responsible for storing the data in a convenient form so that it can then be displayed via a series of views. So the app will include a model with suitable members to store the incoming data. I'm just unsure how you hook into Django to make new instances of those model objects and tell Django to store them.
How can I periodically run a Python script to import data into a Django app?
16,125,548
1
1
3,419
0
python,django,data-importer
Forget about this being a Django app for a second. It is just a load of Python code. What this means is, your Python script is absolutely free to import the database models you have in your Django app and use them as you would in a standard module in your project. The only difference here, is that you may need to take care to import everything Django needs to work with those modules, whereas when a request enters through the normal web interface it would take care of that for you. Just import Django and the required models.py/any other modules you need for it work from your app. It is your code, not a black box. You can import it from where ever the hell you want. EDIT: The link from Rohan's answer to the Django docs for custom management commands is definitely the least painful way to do what I said above.
0
0
0
0
2012-07-05T17:30:00.000
8
0.024995
false
11,349,476
0
0
1
4
I have a script which scans an email inbox for specific emails. That part's working well and I'm able to acquire the data I'm interested in. I'd now like to take that data and add it to a Django app which will be used to display the information. I can run the script on a CRON job to periodically grab new information, but how do I then get that data into the Django app? The Django server is running on a Linux box under Apache / FastCGI if that makes a difference. [Edit] - in response to Srikar's question When you are saying " get that data into the Django app" what exactly do you mean?... The Django app will be responsible for storing the data in a convenient form so that it can then be displayed via a series of views. So the app will include a model with suitable members to store the incoming data. I'm just unsure how you hook into Django to make new instances of those model objects and tell Django to store them.
Scraper Google App Engine for Steam
11,350,089
1
0
614
0
jquery,python,html,google-app-engine,steam-web-api
Since you have the steam id from the service you can then make another request to their steam community page via the id. From there you can use beautiful soup to return a dom to grab the required information for your project. Now onto your question. You can have all this happen within a request in a handler, if you are using a web framework such as Tornado, and the handler can return json in the page and you can render this json using your javascript code. Look into a web framework for python such as Tornado or Django to help you with return and displaying the data.
0
1
0
0
2012-07-05T17:46:00.000
2
0.099668
false
11,349,709
0
0
1
1
So basically, at the moment, we are trying to write a basic HTML 5 page that, when you press a button, returns whether the user, on Steam, is in-game, offline, or online. We have looked at the Steam API, and to find this information, it requires the person's 64 bit ID (steamID64) and we, on the website, are only given the username. In order to find their 64 bit id, we have tried to scrape off of a website (steamidconverter.com) to get the user's 64 bit id from their username. We tried doing this through the javascript, but of course we ran into the cross domain block, not allowing us to access that data from our google App Engine website. I have experience in Python, so I attempted to figure out how to get the HTML from that website (in the form of steamidconverter.com/(personsusername)) with Python. That was a success in scraping, thanks to another post on Stack Overflow. BUT, I have no idea how to get that data back to the javascript and get it to do the rest of the work. I am stumped and really need help. This is all on google App Engine. All it is at the moment, is a button that runs a simple javascript that attempts to use JQuery to get the contents of the page back, but fails. I don't know how to integrate the two! Please Help!
What's the difference between timer and rbtimer in uWSGI?
11,353,126
11
5
826
0
python,timer,uwsgi
@timer uses kernel-level facilities, so they are limited in the maximum number of timers you can create. @rbtimer is completely userspace so you can create an unlimited number of timers at the cost of less precision
0
1
0
1
2012-07-05T19:06:00.000
1
1.2
true
11,350,907
0
0
1
1
I'm looking to add simple repeating tasks to my current application and I'm looking at the uwsgi signals api and there are two decorators @timer and @rbtimer. I've tried looking through the doc and even the python source at least but it appears it's probably more low level than that somewhere in the c implementation. I'm familiar with the concept of a red-black tree but I'm not sure how that would relate to timers. If someone could clear things up or point me to the doc I might have missed I'd appreciate it.
How to respond to an HTTP request using Python
11,353,286
0
1
750
0
python,ios,webserver,download
If you're literally just serving content (ie, not doing any calculations or look-ups), then use the nginx webserver to serve it based on URL.
0
0
1
0
2012-07-05T22:06:00.000
4
0
false
11,353,206
0
0
1
1
I am trying to write an iPhone application that uses a Python server. The iPhone application will send an HTTP request to the server, which should then respond by sending back a file that is on the server. What is the best way to do this? Thanks.
Preventing a security breach
11,378,667
1
0
2,607
0
python,html,pyramid,templating
You can replace the <script>, <iframe> tags with something else or you can html encode the strings so that it appears as text on the page but is not rendered by the browser itself. Doing a string replace of all <'s and >'s with the &lt and &gt should be more than sufficient at preventing the XSS you are seeing as well.
0
0
0
0
2012-07-07T21:08:00.000
5
0.039979
false
11,378,645
0
0
1
3
I am creating a website where you "post", and the form content is saved in a MySql database, and upon loading the page, is retrieved, similar to facebook. I construct all the posts and insert raw html into a template. The thing is, as I was testing, I noticed that I could write javascript or other HTML into the form and submit it, and upon reloading, the html or JS would treated as source code, not a post. I figured that some simple encoding would do the trick, but using <form accept-charset="utf-8"> is not working. Is there an efficient way to prevent this type of security hole?
Preventing a security breach
11,378,727
0
0
2,607
0
python,html,pyramid,templating
It's a little out there, but you could write a block of code to recognize certain key aspects of html/javascript codes and act accordingly. recognize the block, for example, and either not allow that query to be passed or edit it so it's no longer valid html....
0
0
0
0
2012-07-07T21:08:00.000
5
0
false
11,378,645
0
0
1
3
I am creating a website where you "post", and the form content is saved in a MySql database, and upon loading the page, is retrieved, similar to facebook. I construct all the posts and insert raw html into a template. The thing is, as I was testing, I noticed that I could write javascript or other HTML into the form and submit it, and upon reloading, the html or JS would treated as source code, not a post. I figured that some simple encoding would do the trick, but using <form accept-charset="utf-8"> is not working. Is there an efficient way to prevent this type of security hole?
Preventing a security breach
11,379,323
8
0
2,607
0
python,html,pyramid,templating
Well, for completeness of the picture I'd like to mention that there are two places where you can sanitize user input in Pyramid - on the way in, before saving data in the database, and on the way out, before rendering the data in the template. Arguably, there's nothing wrong with storing HTML/JavaScript in the database, it's not going to bite you - as long as you ensure that everything that is rendered in your template is properly escaped. In fact, both Chameleon and Mako templating engines have HTML escaping turned on by default, so if you just use them "as usual", you'll never get user-entered HTML injected into your page - instead, it'll be rendered as text. Without this, sanitizing user input would be a daunting task as you'd need to check every single field in every single form user enters data into (i.e. not only "convenient" textarea widgets, but everything else too - user name, user email etc.). So you must be doing something unusual (or using some other template library) to make Pyramid behave this way. If you provide more details on the templating library you're using and a code sample, we'll be able to find ways to fix it in a proper way.
0
0
0
0
2012-07-07T21:08:00.000
5
1
false
11,378,645
0
0
1
3
I am creating a website where you "post", and the form content is saved in a MySql database, and upon loading the page, is retrieved, similar to facebook. I construct all the posts and insert raw html into a template. The thing is, as I was testing, I noticed that I could write javascript or other HTML into the form and submit it, and upon reloading, the html or JS would treated as source code, not a post. I figured that some simple encoding would do the trick, but using <form accept-charset="utf-8"> is not working. Is there an efficient way to prevent this type of security hole?
Reading RSS feeds in php or python/something else?
15,361,568
0
0
269
0
php,python,symfony
Is solved this by adding a usleep() function at the end of each iteration of a feed. This drastically lowered cpu and memory consumption. The process used to take about 20 minutes, and now only takes around and about 5!
0
0
0
1
2012-07-08T09:43:00.000
3
1.2
true
11,382,163
0
0
1
2
I currently am developing a website in the Symfony2 framework, and i have written a Command that is run every 5 minutes that needs to read a tonne of RSS news feeds, get new items from it and put them into our database. Now at the moment the command takes about 45 seconds to run, and during those 45 seconds it also takes about 50% to up to 90% of the CPU, even though i have already optimized it a lot. So my question is, would it be a good idea to rewrite the same command in something else, for example python? Are the RSS/Atom libraries available for python faster and more optimized than the ones available for PHP? Thanks in advance, Jaap
Reading RSS feeds in php or python/something else?
11,393,069
0
0
269
0
php,python,symfony
You could try to check Cache-Headers of the feeds first before parsing them. This way you can save the expensive parsing operations on probably a lot of feeds. Store a last_updated date in your db for the source and then check against possible cache headers. There are several, so see what fits best or is served the most or check against all. Headers could be: Expires Last-Modified Cache-Control Pragma ETag But beware: you have to trust your feed sources. Not every feed provides such headers or provides them correctly. But i am sure a lot of them do.
0
0
0
1
2012-07-08T09:43:00.000
3
0
false
11,382,163
0
0
1
2
I currently am developing a website in the Symfony2 framework, and i have written a Command that is run every 5 minutes that needs to read a tonne of RSS news feeds, get new items from it and put them into our database. Now at the moment the command takes about 45 seconds to run, and during those 45 seconds it also takes about 50% to up to 90% of the CPU, even though i have already optimized it a lot. So my question is, would it be a good idea to rewrite the same command in something else, for example python? Are the RSS/Atom libraries available for python faster and more optimized than the ones available for PHP? Thanks in advance, Jaap
How to delete an app from a django project
11,382,790
0
27
47,184
0
python,django
It depends on the app (how it was installed, how it was used, etc) but usually you can remove app from INSTALLED_APPS and then delete its tables in the database.
0
0
0
0
2012-07-08T11:22:00.000
3
0
false
11,382,734
0
0
1
2
Initially I made 2 apps (app_a and app_b) in a single project in Django. Now I want to delete one (say app_a). How should I do so? Is removing the app name from INSTALLED_APPS in the settings file sufficient?
How to delete an app from a django project
11,382,770
51
27
47,184
0
python,django
You need to remove or check the following: Remove the app from INSTALLED_APPS. Remove any database tables for the models in that app (see app_name_model_name in your database). Check for any imports in other apps (it could be that they're importing code from that app). Check templates if they are using any template tags of that app (which would produce errors if that app is no longer there). Check your settings file to see if you're not using any code from that app (such as a context processor in your_app/context_processors.py, if it has such as file). Check if any static content of the app is used in other apps. Remove the app directory entirely. When you've been following proper coding principles (i.e., each Django app is a self-contained part of the web application) then most situations above won't occur. But when other apps do use some parts of that app, you need to check that first as it may require refactoring before deleting the app.
0
0
0
0
2012-07-08T11:22:00.000
3
1.2
true
11,382,734
0
0
1
2
Initially I made 2 apps (app_a and app_b) in a single project in Django. Now I want to delete one (say app_a). How should I do so? Is removing the app name from INSTALLED_APPS in the settings file sufficient?
getting javascript form content with python
11,383,885
0
2
453
0
javascript,python,xml,forms
Is your system a web application, If so your javascript can post to python back-end using ajax. Then you can encrypt a form to json string and send to back-end, in back en you can parse that string into python variable... Javascript it self does not have access to your local file except you run it local (but it's really limitted) I suggest you should try a web frame work like Django. It's easy to learn in one day.
0
0
1
0
2012-07-08T14:14:00.000
2
0
false
11,383,796
0
0
1
1
I am a novice python programmer and I am having troubles finding a tool to help me get a form from a javascript. I have written a small script in python and also have a simple interface done in javascript. The user needs to select a few items in the browser and the javascript then returns a sendForm(). I would like to then to recover the form with my python script. I know I could generate an xml file with javascript and tell my python script to wait until its creation and then catch it (with a os.path.exist(..)) but i would like to avoid this. I have seen that libraries such as cgi, mechanize, pyjs,(selenium?) exist to interface python and html,javascript but I can't find which one to use or if there would be another tool that would handle recovering the form easily. More info: the python script generates an xml which is read by javascript. The user selects items in the javascript (with checkboxes) which are then tagged in the xml by javascript. The javascript then outputs the modified xml in a hidden field and it is this modified xml that I wish to retrieve with my python script after it is created. Thank you all a lot for your help
Django views and templates, including Jinja2 and Mako, tutorials and resources
11,388,002
0
0
589
0
python,django,jinja2,mako
We use Mako in our workplace, and I highly recommend not using it. It's great for your own views, but if you want to use ANY third party libraries that include templates, they simply won't work. Other than that, the official documentation, and googling for specific problems you're having is the best way to go when using django templating. Unfortunately, I can't comment on jinja templating.
0
0
0
0
2012-07-09T00:54:00.000
2
0
false
11,387,972
0
0
1
1
I'm new to Python and Django, but now have a pretty firm understanding of basic database and back end programming. However, I am finding it hard to learn the views and templates layers. I was wondering if anyone can suggest additional tutorials and resources, other than the official Django documentation. I am also new to HTML, and am open to tutorials using Mako or Jinja2. Thanks!
How to delete project in django
52,744,961
0
17
46,212
0
python,django,project
Yes. Just Delete the folder. If the project is installed in your settings.py, remove it.
0
0
0
0
2012-07-09T08:26:00.000
4
0
false
11,391,424
0
0
1
4
Initially, I had a single project in Django now I want to delete the last project and start a fresh new project with the same name as the last one. How should I do so? Can deleting the project folders be sufficient.
How to delete project in django
32,165,971
0
17
46,212
0
python,django,project
As @Neverbackdown said deleting folder would be sufficient, but along with that you would also want to delete database or tables.
0
0
0
0
2012-07-09T08:26:00.000
4
0
false
11,391,424
0
0
1
4
Initially, I had a single project in Django now I want to delete the last project and start a fresh new project with the same name as the last one. How should I do so? Can deleting the project folders be sufficient.
How to delete project in django
60,130,219
3
17
46,212
0
python,django,project
To delete the project you can delete the project folder. But this method is good only if you use SQLite as a database. If you use any other database like Postgresql with Django, you need to delete the database manually. If you are on VPS. Simply go to the folder where your project folder resides and put command rm -r projectfoldername This should delete the folder and it's contents.
0
0
0
0
2012-07-09T08:26:00.000
4
0.148885
false
11,391,424
0
0
1
4
Initially, I had a single project in Django now I want to delete the last project and start a fresh new project with the same name as the last one. How should I do so? Can deleting the project folders be sufficient.
How to delete project in django
11,391,460
28
17
46,212
0
python,django,project
Deleting the project folder is sufficient and make changes in your apache server too[if you have one].
0
0
0
0
2012-07-09T08:26:00.000
4
1.2
true
11,391,424
0
0
1
4
Initially, I had a single project in Django now I want to delete the last project and start a fresh new project with the same name as the last one. How should I do so? Can deleting the project folders be sufficient.
What are the limitations of using Django nonrel with Google App Engine?
11,398,730
2
1
341
0
django,google-app-engine,google-cloud-datastore,python-2.7
The big limitation is that the datastore doesn't do JOINs, so anything that uses JOINS, like many-to-many relations won't work. Any packages/middleware that uses many-to-many won't work, but others will. For example, the sessions/auth middleware will work. But if you use permissions with auth, it won't. If you use the admin pages for auth, they use permissions, so you'll have some trouble with those too. i8n works. forms work. nonrel does not work with ndb. I don't know what you mean by "until your project gets bigger". django-nonrel won't help with the size of your app. In my opinion there's two big reasons to use nonrel: You're non-committal about App Engine. Nonrel potentially allows you to move to MongoDB as a backend. You want to use django packages for "free". For example, I used tastypie for a REST API, and django-social-auth to get OAuth for FB/Twitter logins with very little effort. (On the flip side, with 1.7.0, they've addressed the REST API with endpoints)
0
0
0
0
2012-07-09T13:39:00.000
1
1.2
true
11,396,216
0
0
1
1
I understand that full django can be used out of the box with CloudSQL. But I'm interested in using HRD. I'd like to learn more about what percentage of django can be used with nonrel. Does middleware work? How about other features of the framework like i18n, forms, etc. Also does nonrel work with NDB? The background here is that I've even using webapp2 and before that webapp and find them great until your project gets bigger. So for this project I'm interested to reevaluate other options.
python on heroku. Get SIGHUP error
11,418,565
0
0
159
0
python,ruby,heroku
If you are running locally, you can also just run the flask app from the command line using python, skipping Foreman altogether. This is how I run locally on my Windows 7 machines.
0
0
0
0
2012-07-10T14:59:00.000
2
0
false
11,416,158
0
0
1
1
On working through HEROKU's guide to getting Python app to run on HEROKU and one first creates a hello world program ostensibly using python and flask and runs it locally using Foreman. I get an 'unsupported signal SIGHUP' from Ruby/Gems/foreman/engine. I am Running Win7. Anybody else hit this problem or have any ideas ? thanks.
request.accept_language is always null in python
11,420,889
2
0
519
0
python,pylons
Try looking at request.headers['accept-language'], or indeed the entire request.headers object. I suspect your browser is not providing those headers. Also, take a look at the browser request in wireshark, and the client request on the server.
0
0
1
0
2012-07-10T18:50:00.000
1
0.379949
false
11,419,922
0
0
1
1
In pylons project when I do request.accept_language.best_matches(), it is returning me Null. I have set 2 languages in browser (en-us and es-ar) by going to Preferences-Content- Languages in firefox. How can I get the languages specified in the browser? repr(request.accept_language) gives <NilAccept: <class 'webob.acceptparse.Accept'>>
how to darw the image faster in canvas
11,427,225
1
0
41
0
javascript,python
It takes time for the image to get from your phone to your server to your desktop client. There's nothing you can do to change that. The best you can hope to do is to benchmark your entire application, figure out where are your bottlenecks, and hope it's not the network connection itself.
1
0
0
0
2012-07-11T06:57:00.000
1
0.197375
false
11,427,168
0
0
1
1
I am capturing mobile snapshot(android) through monkeyrunner and with the help of some python script(i.e. for socket connection),i made it to display in an html page.but there is some time delay between the image i saw on my browser and that one on the android device.how can i synchronise these things so that the mobile screen snapshot should be visible at the sametime on the browser.
What's the difference between a django package and a python library?
11,429,918
8
5
1,364
0
python,django
A Django package has the general structure of a Django app (models.py, views.py, et cetera) and it can have additional settings to define in your settings.py file. Using the Django package makes it easier to integrate the functionality into your Django web application rather than simply calling a Python library. Usually the Python library provides all the functionality and a Django package provides additional functionality to use it (such as useful template tags, settings or context processors). You'll need to install both as the Django package won't work without the library. But this can vary so you'll need to look into the provided functionalities by the Django package.
0
0
0
0
2012-07-11T09:44:00.000
1
1.2
true
11,429,862
0
0
1
1
I'm new to django and I've been browsing around the djangopackages site. I'm wondering what is the difference between those "django" packages, and python libraries that are not django packages. So for example sendgrid has a django package and also a few regular python libraries. If I want to use the sendgrid wrapper from a django app, what benefits do i get by using the django package rather than the other python libraries that are available and more frequently maintained?
python mechanize odd .read() output
11,458,357
0
0
155
0
python,mechanize
Problem solved: If you are getting similar output, check the page headers as it is probably gzipped after instantiating the browser set set_handle_gzip(True)
0
0
0
1
2012-07-11T16:09:00.000
1
1.2
true
11,436,837
0
0
1
1
I am looking for help debugging Mechanize. When I navigate to a page and attempt to call .read(), I get non-unicode result about 1 out of every 5 or so attempts. The non-unicode result looks like the following: úRW!¤cêLÒ0T¸²ÖþF\<äs +€²Ü@9‚ÈøMq1;=®}ÿ½8¹WP[ëæåñ±øþûÚc!ˆÍzòØåŸ¿þUüþf>àSÕ‹‚~é÷bƪ}Ãp#',®ˆâËýÊæÚ³­õµÊZñMyô‘;–sä„IWÍÞ·mwx¨|ýHåÀ½A ºÒòÀö QNqÒ4O{Žë+óZu"úÒ¸½vº³ÔP”º‘cÇ—Êâ#<31{HiºF4N¨ÂÀ"Û´>•ŠÜÅò€U±§¶8ÑWEú(ƒ‘cÀWÄ~‡ ‡—¯J$ÁvQìfj²a$DdªÐŠÐ5[ü(4`­ ŒÛ"–<‹eñƒ(‚¹=[U¤#íQhÉÔô6(î$M ²-Õ£›Œndû8mØïõ7;"¨zÒ€F°¬@Xˆ€*õ䊈xŸÊ%úÅò= kôc¡¢ØyœÑy³í>ËÜ-¥m+ßê¸ïmì Ycãa®-Ø•†ê¸îmq«x} i¥GEŽj]ÏëUÆËGS°êõ½AxwÕµêúR¶à|ôO¹ýüà:S¸S‡®U%}•Cî3ãg­~QÛó´Ó]ïn[FwuCm6žš[«J®™›Ý-£A˜Ö€sµ1khí"”/\S~u£C7²Í#wÑ»@ç@sô,ÆQèÊôó®.ä(å*æ‡#÷»'õµ­{à˜Õ„SÒ%@ˆtL †¸±¹åI{„Õv#³ëŠUG…s‡•·Aíí»8¡Ò|Ö«à4€¼dˆ¸—áÐåqA­‘ï $Õ[NØÖ£o\s£Z_¾^ Äóo~?<Ú¿Ùÿ]À@@bÈ%¶Á$¦G oË·ò}[µ+>ðµ°Íöе?R1úQ–&PãýT¥¢ði+|óf«ú,â,ÛQ㤚ӢÏì­ÙT£šÚA䡳£ I have tried the normal Mechanize parser (mechanize.Browser()) as well as the commonly suggested alternative (factory=mechanize.RobustFactory()). Any suggestions for next steps?
Django Access File on Server
11,471,280
1
1
846
0
python,ios,django,apple-push-notifications
Never mind, I tried it again using an absolute file path, and it worked after I restarted Django.
0
0
0
0
2012-07-12T04:47:00.000
1
0.197375
false
11,445,143
0
0
1
1
I'm using Django to send iOS push notifications. To do that, I need to access a .pem certificate file currently stored on the server in my app directory along with views.py, models.py, admin.py, etc. When I try to send a push notification from a python shell on the server, everything works fine. But when I try to send a push notification by accessing a Django view, it doesn't send and gives me an SSLError. I think that this is because Django can't find the .pem certificate file. In short, I'm wondering how a Django view function can read in another file on the server.
Django reverse internalization/localization
11,445,895
0
3
302
0
python,django,localization,internationalization,timezone
Time zones is rather simple to implement. Simply use pytz and/or dateutil. Your question is quite broad, can you give an example of specific language issues you're facing?
0
0
0
0
2012-07-12T06:01:00.000
2
0
false
11,445,815
0
0
1
1
This is quite different question. We have a django web application in an European language. Now we want same app in English language. I guess if I just follow the django internalization/localization steps in reverse order, I will be able to make the app in English (The original code was written by someone else). But I think this is not an optimal way to do it.Is there any better way or ways? PS. local timezone will be India for now. We plan to add other countries as well in coming days.
Change db.ComputedProperty from StringProperty to TextProperty
11,497,014
0
1
156
0
python,google-app-engine,text,properties
Have your computed property return an instance of db.Text instead of a String. As Wooble points out, though, there's absolutely no point in doing this: the computed property exists to aid indexing, and if you're not indexing the data, you may as well use a regular property and not store it in the datastore at all.
0
0
0
0
2012-07-12T16:05:00.000
1
0
false
11,455,969
0
0
1
1
I am kind of new to GAE and I was trying to use @db.ComputedProperty to dynamically add field values However I am getting the error message Property xxxx is 721 bytes long; it must be 500 or less. Consider Text instead, which can store strings of any length. It seems that @db.ComputedProperty defaults to StringProperty Is there any way to change it to TextProperty?
Google App Engine - Choosing the right direction
11,460,359
4
0
2,564
0
python,django,google-app-engine,webapp2
The short answer is you can probably go either way, there will be some pros/some cons, but I don't think either is pure win. Here's some pros for using Django-nonrel as a newb: The django docs are generally pretty good. So it helps you get up to speed on some best practices CSRF protection Form validation sessions auth i8n tools You spend less time putting various basic pieces together, django has quite a lot for you. You can potentially save time on stuff like FB/Twitter auth, since there's third party django packages for that. Tastypie is a good rest api package, though you probably don't need it with the new Endpoints The django test framework is great, though the Django 1.4 live test framework (which is even greater) doesn't work for App Engine. I just discovered that yesterday and am trying (so far fruitlessly) to hack it to work. django has a simple tool for dumping the DB to json.  This is pretty useful for testing purposes, for loading/saving fixtures.  You'll have to figure out a way to do this yourself otherwise. cons: Django-nonrel isn't the latest and greatest. For one, you won't have ndb benefits. While django docs are great, django-nonrel docs are not, so you'll have to figure out the setup part. I've been meaning to do a writeup, but haven't had time. Time spent learning django could just as well be spent learning something else, but I think django probably takes less time to learn than a few different pieces. Some people have said django is overweight and takes much longer to load. django-nonrel includes all the django-contrib addins. I've removed many of those and have had no load time problems. (fingers crossed) There's prob more people using webapp2+jinja, I don't see too many separate individuals chiming in on django-nonrel specific issues, though the ones that do have been very helpful. On the other hand, if you run into a generic django problem, there's a lot of django users. One thing I can say though, is if you've written for django, it's hard to move away from it piecemeal. You'll have to have replaced all the pieces that you're using before you can get rid of it, otherwise, you'll still have to include most of the package. An alternative to using django that I know of is gae-boilerplate. It tries to do the same thing but with various different pieces. It still needs a good testing framework though imo.
0
1
0
0
2012-07-12T19:13:00.000
3
0.26052
false
11,458,969
0
0
1
1
I started web development 2 weeks ago using GAE,WebApp2,Jinja2 and WTForms. I read though several articles , discussions , watched lessons about web development with gae (udacity) and started a small project. Now I am very inexperienced in web-development and I don't know which path i should choose. . . The last few days I poked around with GAE and webapp2. It was very easy to use. But I have to say that i only used webapp2 has a request handler. (post / get) For templates I took Jinja2 which was self explanatory too. . . Now Steve from Reddit said that it's always better to use a lightweight framework instead of a very big framework because you have more control and you can scale a lot easier. But I still want to investigate Django-nonrel. I know that Django is limited in GAE. But to be honest I don't even know what Django does for me, (compared to WebApp2 with Jinja2) Now to my questions: Would you recommend a beginner to have a look into Django ? And if I am more experienced => replace some Django code. Stick to WebApp2 + "some template engine" ? . . PS: I don't ask which framework is the best, I just want some points for consideration.
Google App Engine + Google Cloud Storage + Sqlite3 + Django/Python
11,498,320
0
1
2,078
1
python,django,sqlite,google-app-engine,google-cloud-storage
No. SQLite requires native code libraries that aren't available on App Engine.
0
1
0
0
2012-07-12T23:44:00.000
3
1.2
true
11,462,291
0
0
1
2
since it is not possible to access mysql remotely on GAE, without the google cloud sql, could I put a sqlite3 file on google cloud storage and access it through the GAE with django.db.backends.sqlite3? Thanks.
Google App Engine + Google Cloud Storage + Sqlite3 + Django/Python
11,463,047
0
1
2,078
1
python,django,sqlite,google-app-engine,google-cloud-storage
Google Cloud SQL is meant for this, why don't you want to use it? If you have every frontend instance load the DB file, you'll have a really hard time synchronizing them. It just doesn't make sense. Why would you want to do this?
0
1
0
0
2012-07-12T23:44:00.000
3
0
false
11,462,291
0
0
1
2
since it is not possible to access mysql remotely on GAE, without the google cloud sql, could I put a sqlite3 file on google cloud storage and access it through the GAE with django.db.backends.sqlite3? Thanks.
Set up Python on Windows to not type "python" in cmd
67,924,065
2
27
17,143
0
python,windows,path,cmd
I also had the same issue... I could fix it by re-associating *.py files with the python launcher. Right click on a *.py file and open its properties. Click on the Change button of the "Opens with..." section Select More apps -> Look for another app on this PC. Then browse to your windows folder (by default: "C:\Windows") Select "py.exe"
0
1
0
0
2012-07-13T14:47:00.000
4
0.099668
false
11,472,843
0
0
1
1
How do I have to configure so that I don't have to type python script.py but simply script.py in CMD on Windows? I added my python directory to %PATH% that contains python.exe but still scripts are not run correctly. I tried it with django-admin.py Running django-admin.py startproject mysite gives me Type 'django-admin.py help <subcommand>' for help on a specific subcommand. Using python in front of it processes the command correctly. What's the problem here?
Throttling brute force login attacks in Django
11,477,465
5
30
18,059
0
python,django,security,brute-force
You can: Keep track of the failed login attempts and block the attacker after 3 attempts. If you don't want to block then you can log it and present a CAPTCHA to make it more difficult in future attempts. You can also increase the time between login attempts after eached failed attempt. For example, 10 seconds, 30 seconds, 1 minute, 5 minutes, et cetera. This will spoil the fun pretty quickly for the attacker. Of course, choose a secure password as that will keep the attacker guessing.
0
0
0
0
2012-07-13T19:26:00.000
3
0.321513
false
11,477,067
0
0
1
1
Are there generally accepted tactics for protecting Django applications against this kind of attack?
Eclipse randomly replacing tabs with spaces
11,488,572
2
1
166
0
python,eclipse,pydev
This was originally a comment on the OP, but turned out to be the correct answer, so I'm reposting. The setting to replace tabs with spaces exists in two places in eclipse: General > Editors > Text Editors Pydev > Editor Both these settings need to be set correctly in order to solve this problem as they can override each other
0
0
0
0
2012-07-14T22:45:00.000
2
1.2
true
11,487,954
0
0
1
1
I'm editing django files in Eclipse Indigo with pydev. Suddenly in one file, eclipse has decided to start using four spaces instead of tabs. The file has a .py extension. It's fine in other files, it's just this one that it's having trouble with. The settings are correct for using tabs. I've tried closing and reopening the file, qutting and restarting eclipse, removing all the spaces and reloading the file, but still eclipse insists on using spaces, which is really irritating because eclipse then flags it as an error. Anyone else experienced this before, and if so, how did you fix it?
Use Satchmo subscription to the store itself
12,105,661
0
0
118
0
python,django,e-commerce,satchmo
You can listen to satchmo_store.shop.signals.order_success and include in your listener all the required steps for self subscription (user to group, object creation etc.,..).
0
0
0
0
2012-07-15T10:11:00.000
1
0
false
11,491,089
0
0
1
1
I'm trying to set up Satchmo, and I found this cool Subscription Product, but what I want is make a members-only section on the site (a multiple store website) itself. In other words, I want the users to make subscriptions to be able to use certain features. Is this possible in Satchmo? I guess if my website is called xyz.com then I can create xyz store on the system and let it have a subscription product, but can I integrate it with the Django login system? Thanks in advance.
Nothing happens when I do: python manage.py command
58,411,790
0
5
14,807
0
python,django,django-admin
If you had your server running till one point and a certain action/change broke it, try going back to the previous state. In my case there was an email trigger which would put the system in an invalid state if email doesn't go through. Doing git stash followed by selectively popping the stash and trying the runserver helps narrow down the problem to a particular file in your project.
0
0
0
0
2012-07-15T11:34:00.000
10
0
false
11,491,529
0
0
1
4
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Nothing happens when I do: python manage.py command
61,670,225
1
5
14,807
0
python,django,django-admin
Please try this. Uninstall Python. Go inside C drive and search Django. You will get many Django related files. Delete every Django file. don't delete your Django files. Install Python. It's worked for me.
0
0
0
0
2012-07-15T11:34:00.000
10
0.019997
false
11,491,529
0
0
1
4
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Nothing happens when I do: python manage.py command
63,147,601
0
5
14,807
0
python,django,django-admin
if you are using Redis Server on Windows, check it out if Redis Server is running, I had same problem and realized my Redis Server was not running, I ran it and now my manage.py commands work fine.
0
0
0
0
2012-07-15T11:34:00.000
10
0
false
11,491,529
0
0
1
4
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Nothing happens when I do: python manage.py command
63,864,484
0
5
14,807
0
python,django,django-admin
The same happened with me also, but this issue is a minor one as it happens if you have multiple versions of Python on your system, you can select a specific Python version by running python3 or whichever version you want. SO you should start from the beginning, uninstall Django first then, create a virtual environment, decide upon a directory where you want to place it, and run the venv module as a script with the directory path: for e.g: python3 -m venv tutorial-env //This will create the tutorial-env directory if it doesn’t exist, and also create directories inside it Once you’ve created a virtual environment, you may activate it. On Windows, run: tutorial-env\Scripts\activate.bat On Unix or MacOS, run: source tutorial-env/bin/activate Now, In the command prompt, ensure your virtual environment is active, and execute the following command: ...> py -m pip install Django NOTE: If django-admin only displays the help text no matter what arguments it is given, there is probably a problem with the file association in Windows. Check if there is more than one environment variable set for running Python scripts in PATH. This usually occurs when there is more than one Python version installed.
0
0
0
0
2012-07-15T11:34:00.000
10
0
false
11,491,529
0
0
1
4
I'm new to django and currently going through the main tutorial. Even though it was working earlier, when I do python manage.py runserver OR python manage.py -h OR with any other command, the shell doesn't output anything. Wondering what I'm doing wrong.
Is there any way to upload a very large file use django on nginx?
11,502,051
0
5
3,455
0
python,django,apache,nginx,webserver
Nginx is probably the best http server, there is no need to replace it. I will advise you to upload very large files via ftp or nfs share.
0
0
0
0
2012-07-16T09:52:00.000
4
0
false
11,501,950
0
0
1
1
I use django to run my website and nginx for front webserver , but when i upload a very large file to my site, it take me very long time , there is some thing wrong when nginx hand upload large file; the nginx will send the file to django after receive all my post file; so this will take me more time; i want to find some other webserver to replace the nginx; wish your suggest?
Python web framework suggestion for a web service
11,505,774
2
0
170
0
python,json,web-services,web-frameworks
I'm no doubt going to be shot down for this answer, but it needs to be said... You're going to write a service that allows tens of transfers a second, with very large file sizes... Uptime is going to be essential and so is transfer speeds etc... If this is for a business, and not just a personal pet project get the personal responsible for the IT budget to give "Box" or "DropBox" some pennies and use their services (I am not affiliated with either company). On a business level, this gets you up and running straight off, would probably end up cheaper than you coding, designing, debugging, paying for EC2 etc... More related to your question: Flask seems to be an up-coming and usable "simple" framework. That should provide all the functionality without all the bells and whistles. The other I would spend time looking at would be Pyramid - which when using a very basic starter template is very simple, but you've got the machinery behind it to really get quite complex things done. (You can mix url dispatch and traversal where necessary for instance).
0
0
1
0
2012-07-16T13:20:00.000
1
1.2
true
11,505,231
0
0
1
1
I'm gonna write a web service which will allow upload/download of files, managing permissions and users. It will be the interface to which a Desktop app or Mobile App will communicate. I was wondering which of the web frameworks I should use to to that? It is a sort of remote storage for media files. I am going to host the web service on EC2 in a Linux environment. It should be fast (obviously) because It will have to handle tens of requests per second, transferring lots of data (GBs)... Communication will be done using JSon... But how to deal with binary data? If I use base64, it will grow by 33%... I think web2py should be ok, because it is very stable and mature project, but wanted other suggestions before choosing. Thank you.
python website language detection
11,507,534
2
5
4,124
0
python,scrapy,web-crawler,language-detection
If the sites are multilanguage you can send the "Accept-Language:en-US,en;q=0.8" header and expect the response to be in english. If they are not, you can inspect the "response.headers" dictionary and see if you can find any information about the language. If still unlucky, you can try mapping the IP to the country and then to the language in some way. As a last resource, try detecting the language (I don't know how accurate this is).
0
0
1
0
2012-07-16T15:16:00.000
8
0.049958
false
11,507,279
0
0
1
1
i am writing a Bot that can just check thousands of website either they are in English or not. i am using Scrapy (python 2.7 framework) for crawling each website first page , can some one suggest me which is the best way to check website language , any help would be appreciated.
GoogleAppEngine error: rdbms_mysqldb.py:74
11,533,684
1
3
1,146
1
google-app-engine,python-2.7
it's been a while, but I believe I've previously fixed this by adding import rdbms to dev_appserver.py hmm.. or was that import MySQLdb? (more likely)
0
1
0
0
2012-07-17T10:25:00.000
3
0.066568
false
11,520,573
0
0
1
2
Trying to do HelloWorld on GoogleAppEngine, but getting the following error. C:\LearningGoogleAppEngine\HelloWorld>dev_appserver.py helloworld WARNING 2012-07-17 10:21:37,250 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded. Traceback (most recent call last): File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 133, in run_file(file, globals()) File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 129, in run_file execfile(script_path, globals_) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_main.py", line 694, in sys.exit(main(sys.argv)) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_main.py", line 582, in main root_path, {}, default_partition=default_partition) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3217, in LoadAppConfig raise AppConfigNotFoundError google.appengine.tools.dev_appserver.AppConfigNotFoundError I've found posts on GoogleCode, StackO regarding this issue. But no matter what I try, I still can't overcome this error. Python version installed on Windows 7 machine is: 2.7.3 GAE Launcher splash screen displays the following: Release 1.7.0 Api versions: ['1'] Python: 2.5.2 wxPython : 2.8.8.1(msw-unicode) Can someone help?
GoogleAppEngine error: rdbms_mysqldb.py:74
12,513,978
0
3
1,146
1
google-app-engine,python-2.7
just had the exact same error messages: I found that restarting Windows fixed everything and I did not have to deviate from the YAML or py file given on the google helloworld python tutorial.
0
1
0
0
2012-07-17T10:25:00.000
3
0
false
11,520,573
0
0
1
2
Trying to do HelloWorld on GoogleAppEngine, but getting the following error. C:\LearningGoogleAppEngine\HelloWorld>dev_appserver.py helloworld WARNING 2012-07-17 10:21:37,250 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded. Traceback (most recent call last): File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 133, in run_file(file, globals()) File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 129, in run_file execfile(script_path, globals_) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_main.py", line 694, in sys.exit(main(sys.argv)) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_main.py", line 582, in main root_path, {}, default_partition=default_partition) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3217, in LoadAppConfig raise AppConfigNotFoundError google.appengine.tools.dev_appserver.AppConfigNotFoundError I've found posts on GoogleCode, StackO regarding this issue. But no matter what I try, I still can't overcome this error. Python version installed on Windows 7 machine is: 2.7.3 GAE Launcher splash screen displays the following: Release 1.7.0 Api versions: ['1'] Python: 2.5.2 wxPython : 2.8.8.1(msw-unicode) Can someone help?
view in base.html django
56,405,887
0
0
1,353
0
python,django,view
add to setting.py part of TEMPLATE append to context_processors list -> app_name.view.base,
0
0
0
0
2012-07-17T14:30:00.000
4
0
false
11,524,756
0
0
1
1
I have notification scrollbar like on fb or twitter. Top menu.html is directly included by base.html Unfortunatelly, I can use only User method there. Is it possible to not write in every view that I need notifications? I want to once paste in one view and have it always in top menu.html which is in base! from intarface import menu_nots nots = menu_nots(request)
When does the App Engine scheduler use a new thread vs. a new instance?
11,857,757
0
60
2,794
0
python,google-app-engine
If I set threadsafe: true in my app.yaml file, what are the rules that govern when a new instance will be created to serve a request, versus when a new thread will be created on an existing instance? Like people are saying here, if a previous instance is already using 10 threads, a new instance with a new thread would be initiated. A new thread will be created if all other threads are busy, they must be either waiting for some response or with computing results. If I have an app which performs something computationally intensive on each request, does multi-threading buy me anything? In other words, is an instance a multi-core instance or a single core? Now this question is very controversial. Everyone knows the answer but still they are skeptical. Multi-threading can never buy you any good if your task is based on just computations unless you're using a multi-core processor, don't ask me why a multi-core processor will help better, you know the answer. Now google app engine is not sophisticated enough to decide that when new threads should be dispatched to the other processor/core(if it exists), only new instances are dispatched to the other core/processor. Want your thread to run in the other core/processor? Well, throw some skills there and booya! Remember, it's upto you to decide if threads should run in other cores/processors, the engine can not take the responsibility for such because this could lead to so many confusions, the engine is not God. In short, by default the instance is single core, the engine can't decide for you when it should go multi-core. Or, are new threads only spun up when existing threads are waiting on IO? The first part of my answer clears this out. Yes, they only spun up when existing threads are busy, this is how threadsafe works, to prevent deadlocks. Now I can tell you this all, from my personal experience, I worked on the app engine for many months and programmed/debugged/tested apps that were highly dependent on the threadsafe architecture. If you want I can add references(I don't have references, just personal experience, but I'm ready to search and put things on the table for you), but I don't think they are needed in this case, threadsafe works in obvious ways which I have validated myself.
0
1
0
0
2012-07-17T15:23:00.000
3
0
false
11,525,717
1
0
1
1
If I set threadsafe: true in my app.yaml file, what are the rules that govern when a new instance will be created to serve a request, versus when a new thread will be created on an existing instance? If I have an app which performs something computationally intensive on each request, does multi-threading buy me anything? In other words, is an instance a multi-core instance or a single core? Or, are new threads only spun up when existing threads are waiting on IO?
Selenium stuck loading frame with basic authentication
11,547,170
0
0
230
0
python,selenium,webdriver,frame,basic-authentication
Solution: go to the url of the frame itself, and set page load timeout on that page
0
0
1
0
2012-07-17T19:25:00.000
1
0
false
11,529,450
0
0
1
1
I'm using selenium in python to check the page of a website that uses basic authentication on one frame. I'm checking to see if the password I am entering is correct or not, so the basic authentication often gets stuck because the password is wrong. Normally I use sel.set_page_load_timeout(8) and then catch the exception thrown when the page takes too long, but because the page loads except for the one frame, this function is not throwing an exception, and the page is getting stuck. How can I break out of the page?
Flask SQLAlchemy query, specify column names
68,064,416
2
183
191,024
1
python,sqlalchemy,flask-sqlalchemy
result = ModalName.query.add_columns(ModelName.colname, ModelName.colname)
0
0
0
0
2012-07-17T20:16:00.000
10
0.039979
false
11,530,196
0
0
1
1
How do I specify the column that I want in my query using a model (it selects all columns by default)? I know how to do this with the sqlalchmey session: session.query(self.col1), but how do I do it with with models? I can't do SomeModel.query(). Is there a way?
How to get Django to use an updated python on Mac OS X server?
11,531,064
1
0
251
0
django,python-2.7,osx-server
Install it against the updated Python.
0
1
0
0
2012-07-17T21:18:00.000
2
0.099668
false
11,531,025
0
0
1
1
I am using Django on my Mac OS X server. Things are fine, so far. I have been using python 2.6.1 and all works well. I upgraded Python to version 2.7.3. Invoking python in the terminal brings up version 2.7.3, as expected. Checking Django using the {% debug %) reveals that Django is still using the original python 2.6.1 interpreter. On this system, /usr/local/bin contains a symlink to ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python In /usr/bin I find the python interpreter, and from that directory, invoking ./python gets python 2.6.1 running. My $PATH is /Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/mysql/bin:/usr/local/bin which I believe must have been altered on the python 2.7.3 install. What is considered the optimal way to get the command line and Django using the same Python? I am considering either moving the framework version to /usr/bin and sitting a symlink in the framework to the moved new version. On the system is also a /Library/Python directory, that contains the site-packages for versions 2.3, 2.5, and 2.6. In /Library/Python/2.6/site-packages are the major goodies django, mercurial, and south. Where are people putting things, nowadays? I mean, I know I could move things around, but I would like to anticipate where the Django project is going so future upgrades can go smoothly.
What are the problems with loading CSS and JS from Django to IIS7?
11,539,473
5
3
2,367
0
python,django,iis-7,iis-7.5
Right click on your website in IIS7 manager and add a virtual directory name it with the same name of your folder you want IIS to handle. lets say static add the path to your real static folder in your application mine was in myproject/static then ok and here you go :)
0
0
0
0
2012-07-18T09:46:00.000
3
1.2
true
11,538,607
0
0
1
1
I successfully deployed my Django site to IIS7 but I still have problems about how to configure IIS to serve the static files. I tried many many things from the internet but nothing seems to work. Everything is working fine on Django server (manage.py runserver) and with debug = True, but as soon as I turn off debug (debug = False) and open it on IIS, the bootstrap css and js are not loaded. Do you have any ideas about why I'm experiencing this behavior? Perhaps you could point me to a step-by-step guide to help me?
html5 checker compilation
26,174,556
0
3
218
0
java,python,html,symfony,liipfunctionaltestbundle
As noted above: You need to install JDK, not only JRE. That is because you need java compiler.
0
0
0
1
2012-07-18T11:48:00.000
1
0
false
11,540,645
0
0
1
1
I would like to use html5 validator from LiipFunctionalTestBundle in my Symfony2 project. So, I followed instructions on bundle's github page, but I got this error during python build: IOError: [Errno 2] No such file or directory: './syntax/relaxng/datatype/java/dist/html5-datatypes.jar' indeed, there is a "dist" folder under that path, but it's empty (no files inside). I also tried to download file from daisy-pipeline, but it's deleted after running python build again I'm using Java 1.7.0_04 on Ubuntu x64
How to make Django unit-tests all retrieve from the same test database?
11,544,226
0
0
133
0
python,database,django,unit-testing
This is the default behavior of Django's transactional test case to perform a rollback after each test. There is nothing preventing you, though, to have a module function, test case method or to override TestCase.setUp() to dynamically create test data. In fact, whenever you find yourself duplicating code, like creating the user and signing in with his credentials with the test client, you should find a way to make those bits reusable across your project's test cases.
0
0
0
0
2012-07-18T13:32:00.000
1
1.2
true
11,542,640
0
0
1
1
Currently when I run a set of unit-tests on Django, each test makes its own database. This means that traversing multiple features of the site all require a user sign up, login, etc.. It would be much simpler if they all fetched from the same temporary database - anyway to do this?
Is it possible to TDD when writing a test runner?
11,546,149
10
2
123
0
python,django,testing,tdd,bootstrapping
Yes. One of the examples Kent Beck works through in his book "Test Driven Development: By Example" is a test runner.
0
0
0
1
2012-07-18T16:11:00.000
2
1
false
11,545,759
1
0
1
2
I am currently writing a new test runner for Django and I'd like to know if it's possible to TDD my test runner using my own test runner. Kinda like compiler bootstrapping where a compiler compiles itself. Assuming it's possible, how can it be done?
Is it possible to TDD when writing a test runner?
11,546,191
4
2
123
0
python,django,testing,tdd,bootstrapping
Bootstrapping is a cool technique, but it does have a circular-definition problem. How can you write tests with a framework that doesn't exist yet? Bootstrapping compilers can get around this problem in several ways, but it's my understanding that usually the first implementation isn't bootstrapped. Later bootstraps would be rewrites that then use the original compiler to compile themselves. So use an existing framework to write it the first time out. Then, once you have a stable release, you can re-write the tests using your own test-runner.
0
0
0
1
2012-07-18T16:11:00.000
2
1.2
true
11,545,759
1
0
1
2
I am currently writing a new test runner for Django and I'd like to know if it's possible to TDD my test runner using my own test runner. Kinda like compiler bootstrapping where a compiler compiles itself. Assuming it's possible, how can it be done?
How to transfer variable data from Python to Javascript without a web server?
11,547,371
4
1
10,066
0
javascript,python,html,file
You just need to get the data you have in your python code into a form readable by your javascript, right? Why not just take the data structure, convert it to JSON, and then write a .js file that your .html file includes that is simply var data = { json: "object here" };
0
0
1
0
2012-07-18T17:37:00.000
6
1.2
true
11,547,150
1
0
1
1
I'm working on automatically generating a local HTML file, and all the relevant data that I need is in a Python script. Without a web server in place, I'm not sure how to proceed, because otherwise I think an AJAX/json solution would be possible. Basically in python I have a few list and dictionary objects that I need to use to create graphs using javascript and HTML. One solution I have (which really sucks) is to literally write HTML/JS from within Python using strings, and then save to a file. What else could I do here? I'm pretty sure Javascript doesn't have file I/O capabilities. Thanks.
Data structures in python: maintaining filesystem structure within a database
11,554,828
2
4
1,195
1
python,database,data-structures,filesystems
I suggest to follow the Unix way. Each file is considered a stream of bytes, nothing more, nothing less. Each file is technically represented by a single structure called i-node (index node) that keeps all information related to the physical stream of the data (including attributes, ownership,...). The i-node does not contain anything about the readable name. Each i-node is given a unique number (forever) that acts for the file as its technical name. You can use similar number to give the stream of bytes in database its unique identification. The i-nodes are stored on the disk in a separate contiguous section -- think about the array of i-node structures (in the abstract sense), or about the separate table in the database. Back to the file. This way it is represented by unique number. For your database representation, the number will be the unique key. If you need the other i-node information (file attributes), you can add the other columns to the table. One column will be of the blob type, and it will represent the content of the file (the stream of bytes). For AJAX, I gues that the files will be rather small; so, you should not have a problem with the size limits of the blob. So far, the files are stored in as a flat structure (as the physical disk is, and as the relational database is). The structure of directory names and file names of the files are kept separately, in another files (kept in the same structure, together with the other files, represented also by their i-node). Basically, the directory file captures tuples (bare_name, i-node number). (This way the hard links are implemented in Unix -- two names are paired with the same i-none number.) The root directory file has to have a fixed technical identification -- i.e. the reserved i-node number.
0
0
0
0
2012-07-19T05:50:00.000
2
0.197375
false
11,554,676
0
0
1
1
I have a data organization issue. I'm working on a client/server project where the server must maintain a copy of the client's filesystem structure inside of a database that resides on the server. The idea is to display the filesystem contents on the server side in an AJAX-ified web interface. Right now I'm simply uploading a list of files to the database where the files are dumped sequentially. The problem is how to recapture the filesystem structure on the server end once they're in the database. It doesn't seem feasible to reconstruct the parent->child structure on the server end by iterating through a huge list of files. However, when the file objects have no references to each other, that seems to be the only option. I'm not entirely sure how to handle this. As near as I can tell, I would need to duplicate some type of filesystem data structure on the server side (in a Btree perhaps?) with objects maintaining pointers to their parents and/or children. I'm wondering if anyone has had any similar past experiences they could share, or maybe some helpful resources to point me in the right direction.
Good ways to name django projects which contain only one app
11,555,375
6
17
6,056
0
python,django
Usually, for projects that are going to be used by only one installation, I usually name my projects as "who will be using the system" (e.g. the organization's name) and the apps as "major features of the system". However, if your app is really that simple that you don't expect to be using multiple apps, then django might be too heavyweight and you might actually be better served by using something simpler.
0
0
0
0
2012-07-19T06:11:00.000
3
1
false
11,554,892
0
0
1
1
When creating projects which contain just a single app, what are the good ways to name the project? I can think without any confusion how to name my app but I need a project name for it. (Can i create a app without a project? If yes, Is it good to do that ?) [Update] I saw some projects on github which contain single app are named as django-[appname]. I liked it and will be following it for naming my projects which contain a single app. Django might be overkill for single app projects but as of now i have just started learning django so i have only one app in my projects. Thanks
Can I format the output of logger action of a content rule as CSV in Plone 4.1?
11,560,834
-1
1
85
0
python,plone
This can be achieved in two ways, these two methods are differentiated in Step 3: Step 1: Records are generally written in a line in zinstance.log. (There are some instances where it is written in multiple lines, so you need to handle exceptions). So here you can use readline function to read each record. Step 2: After reading record, and writing to respective places where ever you wnat using writelines. Step 3: After reading and writing records, now you have two choices: Method 1: You can copy the zinstance.log till whereever you have read to other location(subtitled with date and time, so that you will have logs always available) and create a new empty zinstance.log (Server will automatically write new logs to the new file, which will be available to you when ever you will run your program next time) at the location wherever it was. Method 2: You can also keep the pointer to the position, till wherever you have read, in a file, which is read next time you are running your program and start reading records from that position. This method may lead to unreliability, as if file size goes above the range of data type, then it will curropt the pointer till wherever you have read. Since log files are large enough, so its better not to take this approach Hope this will answer your concern
0
1
0
0
2012-07-19T11:20:00.000
1
-0.197375
false
11,559,752
0
0
1
1
I created a content rule to run a logger action, when a new content is added viz a file. When I run the view of the zinstance.log file,on linux I see all the logs. I wish to send the output for each logger action separately to another log file, so that it contains log concerned to that rule only where ever applicable in the Plone site. How can this be achieved. Is there any add-on for the same ? I know that we can grep the o/p and pipe it to a CSV for formatting it later.
passing variables to a template on a redirect in python
11,565,405
1
7
6,838
0
python,google-app-engine,redirect,jinja2
The easiest way is to use HTML forms, the POST request for submitting the form should include the values on the submit.
0
0
0
0
2012-07-19T16:32:00.000
2
0.099668
false
11,565,313
0
0
1
1
I am relatively new to Python so please excuse any naive questions. I have a home page with 2 inputs, one for a "product" and one for an "email." When a user clicks submit they should be sent to "/success" where it will say: You have requested "product" You will be notified at "email" I am trying to figure out the best way to pass the "product" and "email" values through the redirect into my "/success" template. I am using webapp2 framework and jinja within Google App Enginge. Thanks
how to prevent multiple votes from a single user
11,565,728
1
1
430
0
python,google-app-engine,jinja2,voting-system
Store the voting user with the vote, and check for an existing vote by the current user, using your database. You can perform the check either before you serve the page (and so disable your voting buttons), or when you get the vote attempt (and show some kind of message). You should probably write code to handle both scenarios if the voting really matters to you.
0
0
0
0
2012-07-19T16:53:00.000
2
1.2
true
11,565,662
0
0
1
1
I am writing a web app on google app engine with python. I am using jinja2 as a templating engine. I currently have it set up so that users can upvote and downvote posts but right now they can vote on them as many times as they would like. I simply have the vote record in a database and then calculate it right after that. How can I efficiently prevent users from casting multiple votes?
Getting jobs from beanstalkd - timed out exception
11,570,528
4
0
1,433
0
python,timeout,jobs,beanstalkd,beanstalkc
Calling beanstalk.reserve(timeout=0) means to wait 0 seconds for a job to become available, so it'll time out immediately unless a job is already in the queue when it's called. If you want it never to time out, use timeout=None (or omit the timeout parameter, since None is the default).
0
1
0
1
2012-07-19T18:53:00.000
1
1.2
true
11,567,431
0
0
1
1
I am using Python 2.7, beanstalkd server with beanstalkc as the client library. It takes about 500 to 1500 ms to process each job, depending on the size of the job. I have a cron job that will keep adding jobs to the beanstalkd queue and a "worker" that will run in an infinite loop getting jobs and processing them. eg: def get_job(self): while True: job = self.beanstalk.reserve(timeout=0) if job is None: timeout = 10 #seconds continue else: timeout = 0 #seconds self.process_job(job) This results in "timed out" exception. Is this the best practice to pull a job from the queue? Could someone please help me out here?
How to invoke a python script after successfully running a Django view
11,576,960
1
0
382
0
python,django,django-views
Runing a script from the javascript is not a clean way to do it, because the user can close the browser, disable js ... etc. instead you can use django-celery, it let you run backgroud scripts and you can check to status of the script dynamically from a middleware. Good luck
0
0
0
0
2012-07-20T06:35:00.000
3
1.2
true
11,574,025
0
0
1
1
Lets say I have a view page(request) which loads page.html. Now after successfully loading page.html, I want to automatically run a python script behind the scene 10 - 15 sec after the page.html loaded. How it is possible? Also, is it possible to show the status of the script dynamically (running/ stopped/ Syntax Error..etc)
How can I save my secret keys and password securely in my version control system?
11,575,518
10
140
36,273
0
python,django,git,version-control
I suggest using configuration files for that and to not version them. You can however version examples of the files. I don't see any problem of sharing development settings. By definition it should contain no valuable data.
0
0
0
1
2012-07-20T08:11:00.000
17
1
false
11,575,398
1
0
1
6
I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it's bad practice to keep secrets (like private keys and database passwords) in a VCS repository. But passwords--like any other setting--seem like they should be versioned. So what is the proper way to keep passwords version controlled? I imagine it would involve keeping the secrets in their own "secrets settings" file and having that file encrypted and version controlled. But what technologies? And how to do this properly? Is there a better way entirely to go about it? I ask the question generally, but in my specific instance I would like to store secret keys and passwords for a Django/Python site using git and github. Also, an ideal solution would do something magical when I push/pull with git--e.g., if the encrypted passwords file changes a script is run which asks for a password and decrypts it into place. EDIT: For clarity, I am asking about where to store production secrets.
How can I save my secret keys and password securely in my version control system?
11,576,543
4
140
36,273
0
python,django,git,version-control
EDIT: I assume you want to keep track of your previous passwords versions - say, for a script that would prevent password reusing etc. I think GnuPG is the best way to go - it's already used in one git-related project (git-annex) to encrypt repository contents stored on cloud services. GnuPG (gnu pgp) provides a very strong key-based encryption. You keep a key on your local machine. You add 'mypassword' to ignored files. On pre-commit hook you encrypt the mypassword file into the mypassword.gpg file tracked by git and add it to the commit. On post-merge hook you just decrypt mypassword.gpg into mypassword. Now if your 'mypassword' file did not change then encrypting it will result with same ciphertext and it won't be added to the index (no redundancy). Slightest modification of mypassword results in radically different ciphertext and mypassword.gpg in staging area differs a lot from the one in repository, thus will be added to the commit. Even if the attacker gets a hold of your gpg key he still needs to bruteforce the password. If the attacker gets an access to remote repository with ciphertext he can compare a bunch of ciphertexts, but their number won't be sufficient to give him any non-negligible advantage. Later on you can use .gitattributes to provide an on-the-fly decryption for quit git diff of your password. Also you can have separate keys for different types of passwords etc.
0
0
0
1
2012-07-20T08:11:00.000
17
0.047024
false
11,575,398
1
0
1
6
I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it's bad practice to keep secrets (like private keys and database passwords) in a VCS repository. But passwords--like any other setting--seem like they should be versioned. So what is the proper way to keep passwords version controlled? I imagine it would involve keeping the secrets in their own "secrets settings" file and having that file encrypted and version controlled. But what technologies? And how to do this properly? Is there a better way entirely to go about it? I ask the question generally, but in my specific instance I would like to store secret keys and passwords for a Django/Python site using git and github. Also, an ideal solution would do something magical when I push/pull with git--e.g., if the encrypted passwords file changes a script is run which asks for a password and decrypts it into place. EDIT: For clarity, I am asking about where to store production secrets.
How can I save my secret keys and password securely in my version control system?
11,666,554
2
140
36,273
0
python,django,git,version-control
Encrypt the passwords file, using for example GPG. Add the keys on your local machine and on your server. Decrypt the file and put it outside your repo folders. I use a passwords.conf, located in my homefolder. On every deploy this file gets updated.
0
0
0
1
2012-07-20T08:11:00.000
17
0.023525
false
11,575,398
1
0
1
6
I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it's bad practice to keep secrets (like private keys and database passwords) in a VCS repository. But passwords--like any other setting--seem like they should be versioned. So what is the proper way to keep passwords version controlled? I imagine it would involve keeping the secrets in their own "secrets settings" file and having that file encrypted and version controlled. But what technologies? And how to do this properly? Is there a better way entirely to go about it? I ask the question generally, but in my specific instance I would like to store secret keys and passwords for a Django/Python site using git and github. Also, an ideal solution would do something magical when I push/pull with git--e.g., if the encrypted passwords file changes a script is run which asks for a password and decrypts it into place. EDIT: For clarity, I am asking about where to store production secrets.
How can I save my secret keys and password securely in my version control system?
11,689,937
3
140
36,273
0
python,django,git,version-control
Provide a way to override the config This is the best way to manage a set of sane defaults for the config you checkin without requiring the config be complete, or contain things like hostnames and credentials. There are a few ways to override default configs. Environment variables (as others have already mentioned) are one way of doing it. The best way is to look for an external config file that overrides the default config values. This allows you to manage the external configs via a configuration management system like Chef, Puppet or Cfengine. Configuration management is the standard answer for the management of configs separate from the codebase so you don't have to do a release to update the config on a single host or a group of hosts. FYI: Encrypting creds is not always a best practice, especially in a place with limited resources. It may be the case that encrypting creds will gain you no additional risk mitigation and simply add an unnecessary layer of complexity. Make sure you do the proper analysis before making a decision.
0
0
0
1
2012-07-20T08:11:00.000
17
0.035279
false
11,575,398
1
0
1
6
I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it's bad practice to keep secrets (like private keys and database passwords) in a VCS repository. But passwords--like any other setting--seem like they should be versioned. So what is the proper way to keep passwords version controlled? I imagine it would involve keeping the secrets in their own "secrets settings" file and having that file encrypted and version controlled. But what technologies? And how to do this properly? Is there a better way entirely to go about it? I ask the question generally, but in my specific instance I would like to store secret keys and passwords for a Django/Python site using git and github. Also, an ideal solution would do something magical when I push/pull with git--e.g., if the encrypted passwords file changes a script is run which asks for a password and decrypts it into place. EDIT: For clarity, I am asking about where to store production secrets.
How can I save my secret keys and password securely in my version control system?
49,701,069
2
140
36,273
0
python,django,git,version-control
This is what I do: Keep all secrets as env vars in $HOME/.secrets (go-r perms) that $HOME/.bashrc sources (this way if you open .bashrc in front of someone, they won't see the secrets) Configuration files are stored in VCS as templates, such as config.properties stored as config.properties.tmpl The template files contain a placeholder for the secret, such as: my.password=##MY_PASSWORD## On application deployment, script is ran that transforms the template file into the target file, replacing placeholders with values of environment variables, such as changing ##MY_PASSWORD## to the value of $MY_PASSWORD.
0
0
0
1
2012-07-20T08:11:00.000
17
0.023525
false
11,575,398
1
0
1
6
I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it's bad practice to keep secrets (like private keys and database passwords) in a VCS repository. But passwords--like any other setting--seem like they should be versioned. So what is the proper way to keep passwords version controlled? I imagine it would involve keeping the secrets in their own "secrets settings" file and having that file encrypted and version controlled. But what technologies? And how to do this properly? Is there a better way entirely to go about it? I ask the question generally, but in my specific instance I would like to store secret keys and passwords for a Django/Python site using git and github. Also, an ideal solution would do something magical when I push/pull with git--e.g., if the encrypted passwords file changes a script is run which asks for a password and decrypts it into place. EDIT: For clarity, I am asking about where to store production secrets.
How can I save my secret keys and password securely in my version control system?
11,713,674
0
140
36,273
0
python,django,git,version-control
You could use EncFS if your system provides that. Thus you could keep your encrypted data as a subfolder of your repository, while providing your application a decrypted view to the data mounted aside. As the encryption is transparent, no special operations are needed on pull or push. It would however need to mount the EncFS folders, which could be done by your application based on an password stored elsewhere outside the versioned folders (eg. environment variables).
0
0
0
1
2012-07-20T08:11:00.000
17
0
false
11,575,398
1
0
1
6
I keep important settings like the hostnames and ports of development and production servers in my version control system. But I know that it's bad practice to keep secrets (like private keys and database passwords) in a VCS repository. But passwords--like any other setting--seem like they should be versioned. So what is the proper way to keep passwords version controlled? I imagine it would involve keeping the secrets in their own "secrets settings" file and having that file encrypted and version controlled. But what technologies? And how to do this properly? Is there a better way entirely to go about it? I ask the question generally, but in my specific instance I would like to store secret keys and passwords for a Django/Python site using git and github. Also, an ideal solution would do something magical when I push/pull with git--e.g., if the encrypted passwords file changes a script is run which asks for a password and decrypts it into place. EDIT: For clarity, I am asking about where to store production secrets.
How to bind multiple reusable Django apps together?
11,582,196
6
22
5,702
0
python,django,django-1.4
Think of it in the same way that you would use any 3rd-party app in your project. "Re-usable" doesn't mean "without dependencies". On the contrary, you'd be hard-pressed to find an app that doesn't have at least one dependency, even if it's just dependent on Django or core Python libraries. (While core Python libraries are usually thought of as "safe" dependencies, i.e. everyone will have it, things do sometimes change between versions of Python, so you're still locking your app into a specific point in time). The goal of re-usuable is the same as that of DRY: you don't want to write the same code over and over again. As a result, it makes sense to break out functionality like a picture app, because you can then use it over and over again in other apps and projects, but your picture app will have dependencies and other packages will depend on it, as long as there are no circular dependencies, you're good (a circular dependency would mean that you haven't actually separated the functionality).
0
0
0
0
2012-07-20T12:19:00.000
4
1
false
11,579,232
0
0
1
2
I try my best to write reusable Django apps. Now I'm puzzled how to put them all together to get the final project. Here is an example of what I mean: I have a picture app that stores, resizes and displays images. Also I have a weblog app that stores, edits and displays texts. Now I want to combine these two to show blog posts with images. To do that I could put foreign key fields in the blog to point at pictures. But then the blog could not be used without the picture app. Also I could create a third app, which is responsible to connect both. What is the 'best practice' way of doing it ? EDIT: Thank you for your very good answers, but I'm still looking for more practical example of how to solve this problem. To complete my example: Sometimes it would be nice to use the blog app without the picture app. But if I hard code the dependency it is no longer possible. So how about 3rd app to combine both ?
How to bind multiple reusable Django apps together?
11,579,395
5
22
5,702
0
python,django,django-1.4
This is a good question, and something I find quite difficult to manage also. But - do you imagine these applications being released publicly, or are you only using them yourself? If you're not releasing, I wouldn't worry too much about it. The other thing is, dependencies are fine to have. The pictures app in your example sounds like a good candidate to be a 'reusable' app. It's simple, does one thing, and can be used by other apps. A blog app on the other hand usually needs to consume other apps like a picture app or a tagging app. I find this dependency fine to have. You could try to abstract it a little, by simply linking to a media resource that was put there by your picture app. It's all just a little bit of common sense. Can you make your apps slim? If yes, then try to create them so they can be reused. But don't be afraid to take dependencies when they make sense. Also, try to allow extension points so you can potentially swap out dependencies for other ones. A direct foreign key isn't going to help here, but perhaps something like signals or Restful APIs can.
0
0
0
0
2012-07-20T12:19:00.000
4
0.244919
false
11,579,232
0
0
1
2
I try my best to write reusable Django apps. Now I'm puzzled how to put them all together to get the final project. Here is an example of what I mean: I have a picture app that stores, resizes and displays images. Also I have a weblog app that stores, edits and displays texts. Now I want to combine these two to show blog posts with images. To do that I could put foreign key fields in the blog to point at pictures. But then the blog could not be used without the picture app. Also I could create a third app, which is responsible to connect both. What is the 'best practice' way of doing it ? EDIT: Thank you for your very good answers, but I'm still looking for more practical example of how to solve this problem. To complete my example: Sometimes it would be nice to use the blog app without the picture app. But if I hard code the dependency it is no longer possible. So how about 3rd app to combine both ?
GAE - Online admin console
11,595,724
0
0
172
0
python,google-app-engine
You can use remote shell, that is on your app engine sdk. For example ~/bin/google_appengine/remote_api_shell.py -s your-app-identifier.appspot.com s~your-app-identifier When you are inside the shell, you will have the db module enabled. in order to use your models, you will have to import them.
0
1
0
0
2012-07-21T05:55:00.000
2
0
false
11,589,862
0
0
1
1
Is there some way I can run custom python code on my google appengine app online? Is there a python console somewhere that I can use? I've seen vague references here and there, but nothing concrete.
Get all IDs in context that come under the active filters in openerp
11,600,778
1
1
753
0
python,openerp,identifier
Apply your filter and change number of visible records to unlimited (press on the field [1 to 80] of 4000 which is on the right top corner of you product tree view).
0
0
0
0
2012-07-21T06:37:00.000
3
0.066568
false
11,590,033
0
0
1
1
I have created a function to export data of selected record to a csv file. For example I have opened the product tree view, there are so many filters, I have selected 'service products filter' showing 5 products, then I click on the action and then the export button in my export wizard, these 5 products shown in the tree view are exported to a csv file. I have more than 4000 consumable products, if I select the filter consumable products, then the tree view will show 80 records(default limit) in the tree view. And if I click on the action and export the details, then I only get the 80 record IDs and these records are exported. But I need to get all consumable product IDs. Is there any way to get all the ids that come under the active filter in the model?
How can I define a constant for model and view in Django
11,590,623
4
2
1,193
0
python,django,view,model,constants
You can put it in const.py and import it in view as well as model.
0
0
0
0
2012-07-21T08:14:00.000
2
1.2
true
11,590,597
0
0
1
2
How can I define a constant so it would be available in views.py and models.py?
How can I define a constant for model and view in Django
11,596,732
0
2
1,193
0
python,django,view,model,constants
It's very likely that views.py will import models.py, so normally it's recommended to put in models.py constants and any other code to be used from views.py, forms.py or any other module inside your app.
0
0
0
0
2012-07-21T08:14:00.000
2
0
false
11,590,597
0
0
1
2
How can I define a constant so it would be available in views.py and models.py?
Simulate Key Press at hardware level - Windows
11,598,099
0
11
14,658
0
java,python,hardware,keystroke,simulate
I'm not on a Windows box to test it against MouseKeys, so no guarantees that it will work, but have you tried AutoHotkey?
0
0
0
1
2012-07-22T05:08:00.000
4
0
false
11,597,892
0
0
1
1
I'm looking for a language or library to allow me to simulate key strokes at the maximum level possible, without physically pressing the key. (My specific measure of the level of the keystroke is whether or not it will produce the same output as a physical Key Press when my computer is already running key listeners (such as MouseKeys and StickyKeys)). I've tried many methods of keystroke emulation; The java AWT library, Java win32api, python win32com sendKeys, python ctypes Key press, and many more libraries for python and Java, but none of them simulate the key stroke at a close enough level to actual hardware. (When Windows MouseKeys is active, sending a key stroke of a colon, semi colon or numpad ADD key just produces those characters, where as a physical press performs the MouseKeys click) I believe such methods must involve sending the strokes straight to an application, rather than passing them just to the OS. I'm coming to the idea that no library for these high (above OS code) level languages will produce anything adequate. I fear I might have to stoop to some kind of BIOS programming. Does anybody have any useful information on the matter whatsoever? How would I go about emulating key presses in lower level languages? Should I be looking for a my-hardware-specific solution (some kind of Fujitsu hardware API)? I almost feel it would be easier to program a robot to simply sit by the hardware and press the keys. Thanks!
How to write tests for static routes defined in app.yaml?
11,600,406
1
1
120
0
python,unit-testing,google-app-engine
I have a post deploy script for the staging environment that just does curl on the urls to validate they are all there. If this script passes (among other things) I will deploy from staging to production.
0
1
0
1
2012-07-22T12:39:00.000
1
0.197375
false
11,600,374
0
0
1
1
I have quite a few static files used in my Google App Engine application (CSS, robots.txt, etc.) They are all defined in app.yaml. I want to have some automated tests that check whether those definitions in app.yaml are valid and my latest changes didn't brake anything. E.g. check that specific URLs return correct responses. Ideally, it should be a part of my app unit tests.
Difference between pinax.apps.accounts, idios profiles, and django.auth.User
14,173,262
1
2
674
0
python,django,pinax
Profiles are meant to be used for public data, or data you'd share with other people and is also more descriptive in nature. Account data are more like settings for you account that drive certain behavior (language or timezone settings) that are private to you and that control how various aspects of the site (or other apps) function.
0
0
0
0
2012-07-22T16:15:00.000
2
0.099668
false
11,601,907
0
0
1
1
What's the difference between pinax.apps.accounts and the idios profiles app that were installed with the profiles base project? As I understand it, the contrib.auth should be just for authentication purpose (i.e. username and password), and the existence of User.names and User.email in the auth model is historical and those fields shouldn't be used; but the distinction between accounts and profiles are lost to me. Why is there pinax.apps.account and idios?
Is virtualenv recommended even for single django based application on a server?
11,609,403
3
1
91
0
python,django,virtualenv
I'd recommend always using virtualenv, because it makes your environment more reproducible -- you can version your dependencies alongside your application, you're not tied to the versions of the python packages in your system repository, and if you need to replicate your environment elsewhere, you can do that even if you're not running exactly the same OS underneath.
0
0
0
0
2012-07-23T08:59:00.000
1
1.2
true
11,609,339
0
0
1
1
If we just want to host single django application on a VPS or some cloud instance, is it still benefitial to use virtualenv ? Or will it be an overkill , and better to use global python setup instead, as only one django application say Project X , will be hosted on that server ? Does virtualenv provide any major benefits for a single application setup in a production environment that I might not be aware of ? eg. django upgradation, cron scripts , etc
Difference between Model and Form validation
11,610,267
0
2
1,664
0
python,django,forms,model
Generally models represent business entities which may be stored in some persistent storage (usually relational DB). Forms are used to render HTML forms which may retreive data from users. Django supports creating forms on the basis of models (using ModelForm class). Forms may be used to fetch data which should be saved in persistent storage, but that's not only the case - one may use forms just to get data to be searched in persistent storage or passed to external service, feed some application counters, test web browser engines, render some text on the basis of data entered by user (e.g. "Hello USERNAME"), login user etc. Calling save() on model instance should guarantee that data will be saved in persistent storage if and only data is valid - that will provide consistent mechanism of validation of data before saving to persistent storage, regardless whether business entity is to be saved after user clicks "Save me" button on web page or in django interactive shell user will execute save() method of model instance.
0
0
0
0
2012-07-23T09:37:00.000
2
0
false
11,609,943
0
0
1
1
I'm currently working on a model that has been already built and i need to add some validation managment. (accessing to two fields and checking data, nothing too dramatic) I was wondering about the exact difference between models and forms at a validation point of view and if i would be able to just make a clean method raising errors as in a formview in a model view ? for extra knowledge, why are thoses two things separated ? And finnaly, what would you do ? There are already some methods written for the model and i don't know yet if i would rewrite it to morph it into a form and simply add the clean() method + i don't exactly know how they work. Oh, and everything is in the admin interface, havn't yet worked a lot on it since i started django not so long ago. Thanks in advance,
What should I use instead of deprecated ImageWithThumbnailsField of django-sorl?
11,617,059
0
0
579
0
python,django,sorl-thumbnail
That must have been a very old version of sorl-thumbnail you were using. I'm not sure what that field actually did for you, but now all you have is ImageField. It serves to automatically update the thumbnail registry if you change or delete it and adds a thumbnail of the assigned image next to the form field in the admin. If you're missing any other functionality, it would be best to actually ask what you can do about that particular functionality specifically.
0
0
0
0
2012-07-23T16:56:00.000
1
1.2
true
11,616,994
0
0
1
1
I'm struggling with ImageWithThumbnailsField which seems deprecated. What should I use instead? I don't want to rewrite large parts of my project as I'm doing only slight bugfixing and updating... Error I'm getting: File "/var/www/project/images/models.py", line 6, in from sorl.thumbnail.fields import ImageWithThumbnailsField ImportError: cannot import name ImageWithThumbnailsField
Capturing search data from other websites
11,629,117
0
2
220
0
php,python,search,web-scraping
You can check the http referrer and see what values have been put in the GET variable, but this is restricted to GET variables ONLY!
0
0
1
0
2012-07-24T10:38:00.000
1
0
false
11,629,077
0
0
1
1
Is there a way to capture search data from other websites? For example, if a user visits any website with a search field, I am interested in what that user types into that search field to get to the desired blogpost/webpage/product. I want to know if this is possible by scraping the site, or by any other means. Also, is it illegal to perform a scraping operation to record such data on a third party website? Also, if this is possible using PHP and Python?