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
Webapp2 - Invalidate user login session, when the user logs in from a different browser
12,605,535
0
1
891
0
python,session,sessionid,webapp2
When you open a website for the first time in a browser session a site session is created. When he logs in you just store the session id in the database. You need to have a nice table with active logins. You can also set a cookie in his browser if you want to keep him logged in if he closes and restarts the browser later. Obviously if the cookie exists modify the session id to the one in the cookie. Cookies are not shared between browsers so in this case if he logs in from a new browser you changes the session id in the active logins table. Also you need to have a small ajax that checks if current session is still active every 5 min or so and logs him out if not.
0
0
0
0
2012-09-12T15:34:00.000
3
0
false
12,391,736
0
0
1
2
I have the following requirement in a webapp2 application. When a user leaves his machine or browser, that user's previous authentication session should be terminated. I am able to do this when a user logs in from a different machine, by storing the remote_addr in the User object at login. When the user's session is requested I check the remote_addr from the request against the user's remote_addr at login. I am not happy with this solution, as it will not work when the user is behind a proxy server and also, it will not work when the user uses different browsers. Does webapp2 store a session id somewhere, so I can use that to see if the user has logged on in a new session?
Which one data load method is the best for perfomance?
12,394,712
2
0
96
0
python,database,python-3.x,redis
The method entirely depends on the requirements. If there is only one client reading and modifying the properties, this is a rather simple problem. When modifying data, just change the instance attributes in your current Python program and -- at the same time -- keep the DB in sync while keeping your program responsive. To that end, you should outsource blocking calls to another thread or make use of greenlets. If there is only one client, there definitely is no need to fetch a property from the DB on each value lookup. If there are multiple clients reading the data and only one client modifying the data, you have to think about which level of synchronization you need. If you need 100 % synchronization, you will have to fetch data from the DB on each value lookup. If there are multiple clients changing the data in the database you better look into a rock-solid industry standard solution rather than writing your own DB cache/mapper. Your distinction between (2) and (3) does not really make sense. If you fetch data on every lookup, there is no need to 'store' data. You see, if there can be multiple clients involved these things quickly become quite complex and it's really hard to get it right.
0
0
0
0
2012-09-12T18:54:00.000
1
1.2
true
12,394,528
0
0
1
1
For example, I have object user stored in database (Redis) It has several fields: String nick String password String email List posts List comments Set followers and so on... In Python programm I have class (User) with same fields for this object. Instances of this class maps to object in database. The question is how to get data from DB for best performance: Load values for each field on instance creating and initialize fields with it. Load field value each time on field value requesting. As second one but after value load replace field property by loaded value. p.s. redis runs in localhost
Migrating virtualenv and Github between computers
12,410,239
9
8
8,279
0
python,git,github,virtualenv
That's because you're not even supposed to move virtualenvs to different locations on one system (there's relocation support, but it's experimental), let alone from one system to another. Create a new virtualenv: Install virtualenv on the other system Get a requirements.txt, either by writing one or by storing the output of pip freeze (and editing the output) Move the requirements.txt to the other system, create a new virtualenv, and install the libraries via pip install -r requirements.txt. Clone the git repository on the other system For more advanced needs, you can create a bootstrapping script which includes virtualenv + custom code to set up anything else. EDIT: Having the root of the virtualenv and the root of your repository in the same directory seems like a pretty bad idea to me. Put the repository in a directory inside the virtualenv root, or put them into completely separate trees. Not only you avoid git (rightfully -- usually, everything not tracked by git is fair game to delete) complaining about existing files, you can also use the virtualenv for multiple repositories and avoid name collisions.
0
0
0
0
2012-09-13T15:47:00.000
4
1
false
12,410,113
1
0
1
3
I primarily work these days with Python 2.7 and Django 1.3.3 (hosted on Heroku) and I have multiple projects that I maintain. I've been working on a Desktop with Ubuntu running inside of a VirtualBox, but recently had to take a trip and wanted to get everything loaded up on my notebook. But, what I quickly discovered was that virtualenv + Github is really easy for creating projects, but I struggled to try and get them moved over to my notebook. The approach that I sort of came up with was to create new virtualenv and then clone the code from github. But, I couldn't do it in the folder that I really wanted because it would say the folder is not empty. So, I would clone it to a tmp folder than them cut/paste the everthing into where I really wanted it. Not TERRIBLE, but I just feel like I'm missing something here and that it should be easier. Maybe clone first, then mkvirtualenv? It's not a crushing problem, but I'm thinking about making some more changes (like getting ride of the VirtualBox and just going with a Dual boot system) and it would be great if I could make it a bit smoother. :) Finally, I found and read a few posts about moving git repos between computers, but I didn't see any dealing with Virtualenv (maybe I just missed it). EDIT: Just to be clear and avoid confusion, I'm not try to "move" the virtualenv. I'm just talking about best way to create a new one. Install the packages, and then clone the repo from github.
Migrating virtualenv and Github between computers
12,410,172
1
8
8,279
0
python,git,github,virtualenv
The nice thing about a virtualenv is that you can describe how to make one, and you can make it repeatedly on multiple platforms. So, instead of cloning the whole thing, clone a method to create the virtualenv consistently, and have that in your git repository. This way you avoid platform-specific nasties.
0
0
0
0
2012-09-13T15:47:00.000
4
0.049958
false
12,410,113
1
0
1
3
I primarily work these days with Python 2.7 and Django 1.3.3 (hosted on Heroku) and I have multiple projects that I maintain. I've been working on a Desktop with Ubuntu running inside of a VirtualBox, but recently had to take a trip and wanted to get everything loaded up on my notebook. But, what I quickly discovered was that virtualenv + Github is really easy for creating projects, but I struggled to try and get them moved over to my notebook. The approach that I sort of came up with was to create new virtualenv and then clone the code from github. But, I couldn't do it in the folder that I really wanted because it would say the folder is not empty. So, I would clone it to a tmp folder than them cut/paste the everthing into where I really wanted it. Not TERRIBLE, but I just feel like I'm missing something here and that it should be easier. Maybe clone first, then mkvirtualenv? It's not a crushing problem, but I'm thinking about making some more changes (like getting ride of the VirtualBox and just going with a Dual boot system) and it would be great if I could make it a bit smoother. :) Finally, I found and read a few posts about moving git repos between computers, but I didn't see any dealing with Virtualenv (maybe I just missed it). EDIT: Just to be clear and avoid confusion, I'm not try to "move" the virtualenv. I'm just talking about best way to create a new one. Install the packages, and then clone the repo from github.
Migrating virtualenv and Github between computers
12,410,230
3
8
8,279
0
python,git,github,virtualenv
In addition to scripting creating a new virtualenv, you should make a requirements.txt file that has all of your dependencies (e.g Django1.3), you can then run pip install -r requirements.txt and this will install all of your dependencies for you. You can even have pip create this for you by doing pip freeze > stable-req.txt which will print out you dependencies as there are in your current virtualenv. You can then keep the requirements.txt under version control.
0
0
0
0
2012-09-13T15:47:00.000
4
0.148885
false
12,410,113
1
0
1
3
I primarily work these days with Python 2.7 and Django 1.3.3 (hosted on Heroku) and I have multiple projects that I maintain. I've been working on a Desktop with Ubuntu running inside of a VirtualBox, but recently had to take a trip and wanted to get everything loaded up on my notebook. But, what I quickly discovered was that virtualenv + Github is really easy for creating projects, but I struggled to try and get them moved over to my notebook. The approach that I sort of came up with was to create new virtualenv and then clone the code from github. But, I couldn't do it in the folder that I really wanted because it would say the folder is not empty. So, I would clone it to a tmp folder than them cut/paste the everthing into where I really wanted it. Not TERRIBLE, but I just feel like I'm missing something here and that it should be easier. Maybe clone first, then mkvirtualenv? It's not a crushing problem, but I'm thinking about making some more changes (like getting ride of the VirtualBox and just going with a Dual boot system) and it would be great if I could make it a bit smoother. :) Finally, I found and read a few posts about moving git repos between computers, but I didn't see any dealing with Virtualenv (maybe I just missed it). EDIT: Just to be clear and avoid confusion, I'm not try to "move" the virtualenv. I'm just talking about best way to create a new one. Install the packages, and then clone the repo from github.
Django - multi site
12,416,400
3
1
330
0
python,django,e-commerce
Better idea to use sites framework? Yes. I don't think so but I could be wrong? No. How would django handle many websites? vhosts. Could it be solved through some kind of middleware? As well. Sure. How to go about that? Pay a programmer
0
0
0
0
2012-09-13T23:42:00.000
1
0.53705
false
12,416,328
0
0
1
1
I am currently planning to build a SaaS e-commerce application in python (django). The application will create new e-commerce websites as requested. Each e-commerce needs its own templates/configuration but the core functions stay the same. Each owner decides what goes where and the page layout. So, from what I understood, I would have to create apps separately from the projects so that they can be reused across all the sites but each website has its own project with a different config. since each website has its own database. My questions are the following: Would it be a better idea to use the sites framework given by django in this case? I don't think so but I could be wrong? How would django handle many websites? The web port can only be used once so spawning more than one django server is not a possibility. Could it be solved through some kind of middleware? And in which case, how would I go about that? I am really interested to learn and would really appreciate all the help I can receive! Thank you very much for your time. :-)
Use compressed JavaScript file (not run time compression)
12,436,279
0
3
332
0
javascript,python,extjs,embedded
What you need to do, when the "all-classes.js" file is requested, is to return the content of "all-classes.js.gzip" with the additional "Content-Encoding: gzip" HTTP header. But it's only possible if the request contained the "Accept-Encoding: gzip" HTTP header in the first place...
0
0
0
1
2012-09-14T05:50:00.000
1
1.2
true
12,418,822
0
0
1
1
I have to deploy a heavily JS based project to a embedded device. Its disk size is no more than 16Mb. The problem is the size of my minified js file all-classes.js is about 3Mb. If I compress it using gzip I get a 560k file which saves about 2.4M. Now I want to store all-classes.js as all-classes.js.gz so I can save space and it can be uncompressed by browser very well. All I have to do is handle the headers. Now the question is how do I include the .gz file so browser understands and decompresses? Well i am aware that a .gz file contains file structure information while browser accepts only raw gzipped data. In that I would like to store the raw gzipped data. It'd some sort of caching!
Openerp: onChange event to create lines on account move
12,600,879
0
2
2,338
0
python,onchange,openerp
sometimes error '0' will be generate so we have to write a code with like this. In case of above Example lis.append((0,0,res))
0
0
0
0
2012-09-14T15:40:00.000
3
0
false
12,427,782
0
0
1
1
I have a field amount on the Journal Entries (account move form) and I need to define an onChange event which automatically inserts the lines once I fill in the amount. But I am not sure how.
Safe objective multiplayer game state with multiple threads
12,430,890
0
2
414
0
python,django,redis,multiplayer,gevent
You have described your options well enough. Probably you need to combine both approaches. Ensure that you have as little shared state as possible. Use queue for modifications to whatever shared state remains.
0
0
0
0
2012-09-14T17:50:00.000
1
0
false
12,429,556
0
0
1
1
I'm building a multiplayer card game with Python, gevent and django-socketio and I'm wondering about the best way to maintain state on things, bearing in mind that there'll be multiple clients connecting at once and doing things. I'm using Redis as a datastore for the in game bits, with light object models on top (Redisco at the mo). I'm concerned about defending against race conditions and therefore keeping the game state safe and consistent with so many clients trying to do things at once. I'm thinking that my main options are: (1) - Ensure that all operations are safe with more that one client doing things at once (eg, a player can only interact with certain properties of their own player model, and there's some objective game state via another thread or something which does anything else.) (2) - Use a queue with some global lock to ensure client operations all happen in a certain guaranteed order, and one finishes before the next one starts. I'm using Python, Django, django-socketio, gevent, but think this applies more broadly. Is this the "threadsafe" thing that people refer to? I guess in theory I think I prefer the idea of (1), and I think that I can ensure safe operations by just modifying a single Redis key at a time, or safe sets of atomic operations, but I guess I'd either need to throw away the Redisco models or be very careful about understanding when things get saved and written. I think that's fine for just a couple of us working on things but might be dangerous longer term with more people in the codebase. Thanks!
Disable caching in Apache 2 for Python Development
12,432,255
4
2
1,461
0
python,apache,caching,wsgi
Its a very bad setting from a performance point of view, but what I do in my http.conf is set MaxRequestsPerChild to 1. This has the effect of each apache process handles a single request before dying. It kills throughput (so don't run benchmarks with that setting, or use it on a production site), but it has the effect of giving python a clean environment for every request.
0
0
0
1
2012-09-14T21:18:00.000
2
0.379949
false
12,432,130
0
0
1
1
Developing in Python using mod-python mod-wsgi on Apache 2. All running fine, but if I do any change on my PY file, the changes are not propagated until I restart Apache /etc/init.d/apache2 restart. This is annoying since I can't SSH and restart Apache service everytime in development. Is there any way to disable Apache caching? Thank you.
Detecting serial port settings
12,436,940
1
4
2,135
0
python,serial-port,communication
Although part 1 is no direct answer to your question: There are devices, which just have a autodetection (called Auto-bauding) method included, that means: Send a character using your current settings (9k6, 115k2, ..) to the device and chances are high that the device will answer with your (!) settings. I've seen this on HP switches. Second approach: try to re-order the connection possibilities. E.g. chances are high that the other end uses 9k6 with no hardware handshake, but less that it uses 38k4 with software Xon/Xoff. If you break down your tries into just a few, the "brute force" method will be much more efficient.
0
0
0
1
2012-09-15T08:46:00.000
1
0.197375
false
12,435,923
0
0
1
1
From time to time I suddenly have a need to connect to a device's console via its serial port. The problem is, I never remember what port settings (baud rate, data bits, stop bits, etc...) to use with each particular device, and documentation never seems to be lying around when it's really needed. I wrote a Python script, which uses a simple brute-force method (i.e. iterates over all possible settings, sends some test input and displays the response for a human to decide if it makes sense ), but: it takes a long time to complete does not always work (perhaps port reset/timeout issues) just does not seem like a proper way to do this :) So the question is: does anyone know of a procedure to auto-detect what port settings the remote device is using?
Python : Rendering part of webpage with proper styling from server
12,437,002
1
0
118
0
python,web-scraping
Download the complete webpage, extract the style elements and the stylesheet link elements and download the files referenced the latter. That should give you the CSS used on the page.
0
0
1
0
2012-09-15T10:24:00.000
1
1.2
true
12,436,551
0
0
1
1
I am building a screen clipping app. So far: I can get the html mark up of the part of the web page the user has selected including images and videos. I then send them to a server to process the html with BeautifulSoup to sanitize the html and convert all relative paths if any to absolute paths Now I need to render the part of the page. But I have no way to render the styling. Is there any library to help me in this matter or any other way in python ? One way would be to fetch the whole webpage with urllib2 and remove the parts of the body I don't need and then render it. But there must be a more pythonic way :) Note: I don't want a screenshot. I am trying to render proper html with styling. Thanks :)
Auto Text Summarization
55,256,456
0
2
1,797
0
python,django,nlp,summarization
About papers, I would like to add to the previous answer next ones: "Text Data Management and Analysis" by ChengXiang Zhai and Sean Massung, chapter 16. "Texts in Computer Science: Fundamentals of Predictive Text Mining" by Sholom M. Weiss, Nitin Indurkhya and Tong Zhang (second edition), chapter 9.
0
0
0
0
2012-09-16T04:55:00.000
2
0
false
12,444,496
0
0
1
2
I have decided to develop a Auto Text Summarization Tool using Python/Django. Can someone please recommend books or articles on how to get started? Is there any open source algorithm or made project in the Auto Text Summarization so that I can gain the idea? Also, would you like to suggest me the new challenging FYP for me in Django/Python?
Auto Text Summarization
43,989,780
2
2
1,797
0
python,django,nlp,summarization
First off for Paper, I recommend: 1- Recent automatic text summarization techniques: a survey by M.Gambhir and V.Gupta 2- A Survey of Text Summarization Techniques, A.Nenkova As for tools for Python, I suggest taking a look at these tools: The Conqueror: NLTK The Prince: TextBlob The Mercenary: Stanford CoreNLP The Usurper: spaCy The Admiral: gensim First off learn about different kinds of summarizations and what suits you best. Also, remember to make sure you have a proper preprocessing tool for the language you are targeting as this is very important for the quality of your summarizer.
0
0
0
0
2012-09-16T04:55:00.000
2
0.197375
false
12,444,496
0
0
1
2
I have decided to develop a Auto Text Summarization Tool using Python/Django. Can someone please recommend books or articles on how to get started? Is there any open source algorithm or made project in the Auto Text Summarization so that I can gain the idea? Also, would you like to suggest me the new challenging FYP for me in Django/Python?
Design recommendations for a multi-user web based count down timer
12,462,388
0
1
414
0
java,python,web-applications,timer,clock
Single master clock that is always running (no users need be logged in for clock to continue running) That's not hard. The variance between what any given viewer sees and the actual time on the master clock can not be greater than 1 second. That's pretty much impossible. You can take into account network delays and such , but you can't ensure this. Any changes made to the master clock/countdown timer/countup timer need to be seen by all viewers near instantly. You could do that with sockets, or you could just keep polling the server... do a websearch for "javascript ntp". There are a handful of libraries that will do most of what you want ( and i'd argue, enough of what you want ). most work like this: try to calculate the offset of the local clock to the master clock continually poll master clock for time, trying to figure out the average delay show the time based on fancy math of local vs master clock. years ago i worked on some flash-based chat rooms. a SWF established a socket connection to a TwistedPython server. that worked well enough for our needs, but we didn't care about latency.
0
1
0
0
2012-09-17T14:44:00.000
2
0
false
12,461,724
0
0
1
1
I help with streaming video production on a weekly basis. We stream live video to a number of satellite locations in the Dallas area. In order to ensure that all of the receiving locations are on the same schedule as the broadcasting location we use a desktop clock/timer application and the remote locations VNC into that desktop to see the clock. I would like to replace the current timer application with a web based one so that we can get rid of the inherently fragile VNC solution. Here are my requirements: Single master clock that is always running (no users need be logged in for clock to continue running) The variance between what any given viewer sees and the actual time on the master clock can not be greater than 1 second. Any changes made to the master clock/countdown timer/countup timer need to be seen by all viewers near instantly. Here is my question: I know enough java and python to be dangerous. But I've never written a web app that requires real time syncing between the server and the client like this. I'm looking for some recommendations on how to architect a web application that meets the above requirements. Any suggestions on languages, libraries, articles, or blogs that can point me in the right direction would be appreciated. One caveat though: I would prefer to avoid using Java EE or .Net if possible.
Django 1.1 TemplateSyntaxError - could not import *.static.views
12,468,227
0
0
118
0
python,django,django-1.1
I'm still unsure as to where the reference to cmldb.static.views originated from, but I discovered that there was a missing folder in my svn database that solved the problem. The cmldb.static.views module is now in place, and the site is up and running.
0
0
0
0
2012-09-17T21:50:00.000
1
1.2
true
12,467,607
0
0
1
1
I'm attempting to import a site from an old server that's using Django 1.1 onto a new server. For compatability reasons, I haven't been able to upgrade to the new version of Django. When I attempted to view localhost:8080/admin/, I was able to access the login screen, but after that point I ran into a TemplateSyntaxError. The specific error that it is giving me is: TemplateSyntaxError at /admin/ Caught ViewDoesNotExist while rendering: Could not import cmldb.static.views. Error was: No module named static.views The error is completely correct - there is no module cmldb.static. There is one reference to cmldb.static.views in the urls.py file, though when I change this value I run across the same error. Furthermore, the site that I am importing from has the same urls.py file, yet there is no cmldb.static module in that project either, though that site runs fine. The traceback shows all files that are located within Django package, rather than any files located within my cmldb package, so I am not sure what code, if any, to post. My main confusion is over which file is actually causing this error. Error is: In template /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/base.html, error at line 30 Which reads: 30 {% url django-admindocs-docroot as docsroot %}
How to create a file and append data from html page ?
12,468,383
2
4
6,771
0
javascript,python,html,file,server-side
Browsers have lots of security that prevent this level of control over your computer. This is a good thing. You dont want random websites to be able to do this stuff on anyone's computer that visits them. They way to do this would be to write a web application that your browser could access. The browser can submit data to this application running on your own computer and your application could manipulate the file system or do lots of other things. So no, a browser can't do these things. And yes, you would have to use "another language" to create something which runs outside the browser itself. You can use javascript (see node.js) or python to do this, as well nearly any other programming language that exists to create such a thing. Which to choose is up to you.
0
0
0
0
2012-09-17T23:12:00.000
5
0.07983
false
12,468,335
0
0
1
2
I have an html file on my desktop that takes some input. How would I go about writing that input into a file onto my computer? Would I have to use another language to do it (i.e python or javascript?) and how would I go about doing this? On a related note, is there any way I can have javascript start an application from within an html file (the goal is to write to a file on my computer?
How to create a file and append data from html page ?
15,305,888
0
4
6,771
0
javascript,python,html,file,server-side
Short answer: you can't. The web browser security and sandbox'ing prevents this. Longer answer: setup a small LAMP stack, Ruby on rails(local host server), Python/Django(local host server) to host your HTML/web form. The local daemon can handle appending data to a file, as you enter it into a form. With HTML5, you get special hooks that may allow you to write to the local filesystem, but those may be browser specific and may break from time to time.
0
0
0
0
2012-09-17T23:12:00.000
5
0
false
12,468,335
0
0
1
2
I have an html file on my desktop that takes some input. How would I go about writing that input into a file onto my computer? Would I have to use another language to do it (i.e python or javascript?) and how would I go about doing this? On a related note, is there any way I can have javascript start an application from within an html file (the goal is to write to a file on my computer?
Django website, basic 2d python game
12,470,648
1
11
16,058
0
python,django,web-applications
The game will most probably have to run on the client side. You should take a look into Javascript and AJAX.
0
0
0
0
2012-09-18T04:59:00.000
3
0.066568
false
12,470,633
0
0
1
1
I'm fairly new to web development and Django so bear with me. I'm planning to make a fairly simple website in Django, that part I can manage. I'm then looking to build a few basic 2d games into it, I fully appreciate that you can easily manage this in flash or as a java web app but I'm looking to implement them in python. I've done some research but I'm coming up blank, is there a straightforward way to create 2d python web games that would easily be integrated with django? I'm hoping to build these games in Python so that the users can program their own individual AI's for the game, again in Python, and compete against each other. As a bit of a competition/learning exercise. Thanks in advance and sorry if it turns out to be a stupid question.
creating a configurable permissions system in django
12,480,077
1
0
167
0
python,django
What about storing the new levels in a prefix tree? you could use each level as a node of a branch of the tree. When a new user wants do define a new level, the prefix tree will be updated starting from the level where the user belongs. If your problem is just about giving visibility to the user of the sub-branch of the level where he belongs, this should work. A similar approach, maybe less intuitive, is to give to each level a number (or alpha-numeric value), so that in the end a user associated to the level "state" in your example, has a level code of 23 (let's say: "ex-country": 2 and "state": 3), so that he can add sub-levels starting with the prefix 23.
0
0
0
0
2012-09-18T14:35:00.000
1
0.197375
false
12,479,206
0
0
1
1
I am using django to create a web based app. This app will be used as a service by multiple clients. It has several models / tables that represent a hierarchical relationship. Users are given access based on this hierarchical relationship - ex County -> Schools -> Divisions -> Classrooms. So a user having access to a division has access to all classrooms within it etc My question is how do I make this permissions system configurable across clients. The application should a new client to define arbitrary levels - ex country -> state -> city -> schools -> class. Any ideas on what are good approaches ?
How to convert Django dynamic page to static HTML file?
12,482,179
0
2
380
0
python,django,gunicorn
put it in your /media/ folder then just point to some.url/media/html/some_static_html.html
0
0
0
0
2012-09-18T17:36:00.000
1
0
false
12,482,150
0
0
1
1
The current website is running on Django, Gunicorn and nginx. I want a way to convert the current front page into a static HTML page and want nginx to serve this static page instead of going through the whole web stack. I want the front page to load faster. This can be done manually, but is there a tool integrated with Django or Gunicorn that automatically convert certain page into static and serve those pages?
Django: Create Submodel in Model
12,485,870
1
1
4,720
0
python,django
There is a one-to-many relationship between Book and Page. This means that one Book has several Pages and each Page only one Book. In a database (and therefore in an ORM mapper) you would model this by creating a foreign key in Page. This foreign key would point to the Book instance that contains these Pages. If you want to find the Pages for a Book, you'd query the Pages table for all Pages with the same foreign key as the primary key of the Book.
0
0
0
0
2012-09-18T22:02:00.000
3
0.066568
false
12,485,733
0
0
1
1
Suppose I have two models, Book and Page, such there is a one-to-many relationship between Page to Book. I would like each Book model, to have a function which creates a bunch of Pages for the respective Book model, but I'm not sure how to associate each Page's foreign key back to the Book instance it was created in. I currently have an associate function, which finds the correct book amongst all the possible books, and I'm sure there's a better way, but I can't seem to find it. Is it possible to set the foreignkey to self?
Hide sidebar button in OpenERP
12,493,719
1
3
1,819
0
python,openerp
Go to the "Settings" module: Open menu option Customization -> Low Level Objects -> Window Actions. Search for "SMS" in the Action Name and open it's form. In the "Security" tab you can set the groups that can view this action. Add the "Administrator / Configuration" group and it will be hidden to regular users.
0
0
0
0
2012-09-19T00:12:00.000
5
0.039979
false
12,486,861
0
0
1
2
I'm trying to write a module for OpenERP 6.1 that will hide the "Send an SMS" button on the Partner form. I tried overwriting the window action's id with a different name and src_model, but only the name change appeared. I traced through the code, and it looks like the ir_values records from the base module are still linking the action to the res.partner model. Is there a legitimate way to hide a sidebar button, or am I going to have to modify the base module? I briefly tried restricting permissions on the wizard's table, but that didn't seem to have an effect.
Hide sidebar button in OpenERP
12,497,448
0
3
1,819
0
python,openerp
Please try by creating a new group and provide this group to your button/link and don't add this group to any user.
0
0
0
0
2012-09-19T00:12:00.000
5
0
false
12,486,861
0
0
1
2
I'm trying to write a module for OpenERP 6.1 that will hide the "Send an SMS" button on the Partner form. I tried overwriting the window action's id with a different name and src_model, but only the name change appeared. I traced through the code, and it looks like the ir_values records from the base module are still linking the action to the res.partner model. Is there a legitimate way to hide a sidebar button, or am I going to have to modify the base module? I briefly tried restricting permissions on the wizard's table, but that didn't seem to have an effect.
python/django no module named yelp
12,489,306
3
0
699
0
python,django,api
You need to have an __init__.py inside both the mysite and yelp directories, and you need to import it as mysite.yelp. Older versions of python will allow implicit relative imports, but in general there should be one root package that's importable, and anything inside of it should be imported with the full name. And the way django works, your whole site needs to be the importable package. If there's an existing project available from github, though, it's usually a better idea to install the whole thing on your system instead of copying it into your project. That way if there are updates, you can keep up with what's new and update to the latest.
0
0
0
0
2012-09-19T05:52:00.000
1
1.2
true
12,489,235
0
0
1
1
I downloaded the yelp github for python and there's three files inside the python folder. I placed these three folders inside a folder named yelp which lays inside mysite. (I'm following django's creating first app documentation). This mysite folder has the polls folder as well. When I added yelp into the settings.py INSTALLED_APPS, why do I still get no module named yelp if I tried to do python manage.py runserver? Please help, I'm still trying to learn how python works, what to do when you bring in a new .py file..? thank you!
Why won't pip install anything?
12,583,628
2
2
2,355
0
python-2.7,virtualenv,pip,ubuntu-12.04
Following @HugoTavares's suggestion I found I needed to install python-dev. I don't know why this helped but it seems to have solved this particular problem. I'm putting this answer on for now but Hugo, if you read this, please post an identical one and I'll remove acceptance on this and accept yours, since you deserve the credit.
0
0
0
0
2012-09-19T15:34:00.000
1
1.2
true
12,498,011
1
0
1
1
Whenever I try to pip install anything in my virtualenvs I am told it is Downloading/Unpacking. My terminal then stays on that line indefinitely. The longest I have left this running was 2 hours (trying to install iPython) without success. Most recently, I tried installing django in one virtualenv using pip. Once it said Downloading/Unpacking I created another virtualenv in another terminal window and used easy-install to install django and mezzanine. Both installed with their dependencies before there was any movement on the terminal using pip. I left the pip window running for an hour before giving up. I have tried pip install, pip install -v --use-mirrors and their sudo equivalents without much change in the results (-v --use-mirrors spews out a list of urls before stalling at Downloading/Unpacking). I am using Python 2.7 on Ubuntu 12.04.1 64-bit. I use Virtuanlenvwrapper to create and manage my virtualenvs, if that helps. I can't find any references to other people having this problem so I expect it's a mistake of mine. Does anyone have any idea what I'm doing wrong?
Javascript-Python: serve dynamically generated images to client browser?
12,498,821
1
0
88
0
php,javascript,python
I personally love Socket.IO and I would to it with it. Because it would be simpler a way. But that may be a bit too much work to set up just for that. Especially since it is not that simple in Python from what I heard compare to node where it really is about 10 lines server side. Without Socket.IO could do a long polling to get the status of the image processing, and get the url at the end, of the image in base64 if that is what you want.
0
0
1
0
2012-09-19T16:11:00.000
2
0.099668
false
12,498,694
0
0
1
1
Scenario: User loads a page, image is being generated, show loading bar, notification event sent to browser. I am using python code to generate the image. Would it be ideal to have a web server that launches the script or embed a webserver code into the python script? Once the image is finished rendering, the client should receive a message saying it's successful and display the image. How can this be architected to support concurrent users as well? Would simply launching the python script for each new user that navigates to the web page suffice? Would it be overkill to have real-time web application for this scenario? Trying to decide whether simple jQuery AJAX will suffice or Socket.io should be used to have a persistent connection between server and client. Any libraries out there that fit my needs?
Django: How to upload directly files submitted by a user to another server?
12,623,702
1
2
1,077
0
python,django,file-upload,django-file-upload
You can't actually do both of these at once: I'd like to upload directly these files to the file server. I'd like to make the file server simple as possible. The file server just serve files. Under your requirements, the file server needs to both Serves Files and Accepts Uploads of files. There are a few ways to get the files onto the FileServer the easiest way, is just to upload to the AppServer and then have that upload to another server. this is what most AmazonS3 implementations are like. if the two machines are on the same LAN , you can mount a volume of the FileServer onto the AppServer using NFS or something similar. Users upload to the AppServer, but the data is saved to a partition that is really on the FileServer. You could have a file upload script work on the FileServer. However, you'd need to do a few complex things: have a mechanism to authenticate the ability to upload the file. you couldn't just use an authtkt, you'd need to have something that allows one-and-only-one file upload along with some sort of identifier and privilege token. i'd probably opt for an encrypted payload that is timestamped and has the upload permission credentials + an id for the file. have a callback on successful upload from the FileServer to the AppServer, letting it know that the id in the payload has been successfully received.
0
0
0
0
2012-09-19T18:22:00.000
2
0.099668
false
12,500,623
0
0
1
1
I'm using Django 1.4. There are two servers (app server and file server). The app server provide a web service using django, wsgi, and apache. User can upload files via the web service. I'd like to upload directly these files to the file server. "directly" means that the files aren't uploaded via the app server. I'd like to make the file server simple as possible. The file server just serve files. Ideally, transfer costs between the app server and the file server are zero. Could somebody tell me how to do this?
How to export an IPython notebook to HTML for a blog post?
47,238,955
2
37
14,387
0
ipython,ipython-notebook
Click on file > Download > html
0
0
0
0
2012-09-19T20:13:00.000
5
0.07983
false
12,502,187
1
0
1
1
What is the best way to get an ipython notebook into html format for use in a blog post? It is easy to turn an ipython notebook into a PDF, but I'd rather publish as an html notebook. I've found that if I download the notebook as a .ipynb file, then load it onto gist, then look at it with the ipython notebook viewer (nbviewer.ipython.org), THEN grab the html source, I can paste it into a blog post (or just load it as html anywhere) and it looks about right. However, if I use the "print view" option directly from ipython, the source contains a bunch of javascript rather than the processed html, which is not useful since the images and text are not directly included. The %pastebin magic is also not particularly helpful for this task, since it pastes the python code and not the ipython notebook formatted code. EDIT: Note that this is under development; see the comments under the accepted answer. EDIT May 2 2014: As per Nathaniel's comment, a new answer is needed for ipython 2.0
scrape websites with infinite scrolling
12,529,766
1
31
29,452
0
python,screen-scraping,scraper
Finding the url of the ajax source will be the best option but it can be cumbersome for certain sites. Alternatively you could use a headless browser like QWebKit from PyQt and send keyboard events while reading the data from the DOM tree. QWebKit has a nice and simple api.
0
0
1
0
2012-09-20T18:56:00.000
3
0.066568
false
12,519,074
0
0
1
1
I have written many scrapers but I am not really sure how to handle infinite scrollers. These days most website etc, Facebook, Pinterest has infinite scrollers.
Finding out which module is setting the root logger
12,523,536
0
4
205
0
python,logging
I'm assuming you mean import logging imports a different logging module? In this case, there are many special attributes of modules/packages that can help, such as __path__. Printing logging.__path__ should tell you where python is importing it from.
0
0
0
1
2012-09-20T22:53:00.000
2
0
false
12,522,080
1
0
1
1
How would I be able to find which module is overriding the Python root logger? My Django project imports from quite a few external packages, and I have tried searching for all instances of logging.basicConfig and logging.root setups, however most of them are in tests and should not be overriding it unless specifically called. Django's logging config does not specify a root logger.
What do I need to successfully run a website in my browser that executes Python scripts?
12,522,631
2
0
132
0
python,mysql,web
If you have MySQL installed on your machine along with Python, get a version of MySQLDb library for Python and have fun with it. Moreover, you can do almost any data operation with these combinations. If you want your website to go live (and do not wish to go through web frameworks) just look for a hosting plan that gives you a Python installed server access.
0
0
0
0
2012-09-20T23:00:00.000
2
0.197375
false
12,522,136
0
0
1
1
I currently simply have a local website on my Mac. I can view the webpage's HTMl and CSS and run the javascript functions in browser on my computer, but the next step I want to take is incorporating python scripts for accessing a MySQL database and returning results. I am clearly new to this, and would love some guidance. Right now, on my computer, I have MySQL installed and I can run it in the terminal just fine. What else do I need as far as database and server equipment – if anything – to get some dynamic website running locally? My current, albeit incredibly limited, understanding is that I have a MySQL database stored on my machine that can be accessed through a Python script – also on my machine – and a link to this script in the HTML file. Is this even right, or do you recommend certain tutorials to fill in the gaps or teach me from the ground up? I am sorry I am asking a lot; the few tutorials I have found have seemed to cover what I am hoping to do. Many thanks in advance.
How to fetch time-based entity from datastore in app engine
12,522,188
2
1
391
0
python,google-app-engine,app-engine-ndb
You could add another field for the date. A ComputedProperty would probably make sense for that. Or you could fetch from the start of the day, in batches, and stop fetching once you reach the end of your day. I'd imagine you could come up with a sensible default based on how many appointments you'd typically have in one day to keep this reasonably efficient.
0
1
0
0
2012-09-20T23:03:00.000
3
1.2
true
12,522,160
0
0
1
2
I have an application on app engine, and this application has an entity called Appointment. An Appointment has a start_time and a end_time. I want to fetch appointments based on the time, so I want to get all appointments for a given day, for example. Since app engine doesn't support inequality query based on two fields, what can I do?
How to fetch time-based entity from datastore in app engine
12,535,660
1
1
391
0
python,google-app-engine,app-engine-ndb
The biggest problem is that a "date" means a different start and end "time" depending on a time zone of a user. And you cannot force all of your users to stick to one time zone all of the lives, not to mention DST changes twice a year. So you cannot simply create a new property in your entity to store a "date" object as was suggested. (This is why GAE does not have a "date" type property.) I built a scheduling app. When a user specifies the desired range for events (it can be a day, a week or a month), I retrieve all events that have an end time larger than the start time of the requested range, and then I loop through them until I find the last event which has a start time smaller than the end time of the range. You can specify how many entities you want to fetch in one request depending on a requested range (more for month than for a day). For example, if a given calendar is likely to have 5-10 events per day, it's enough to fetch the first 10 entities (you can always fetch more if condition is not met). For a month you can set a batch size to 100, for example. This is a micro-optimization, however.
0
1
0
0
2012-09-20T23:03:00.000
3
0.066568
false
12,522,160
0
0
1
2
I have an application on app engine, and this application has an entity called Appointment. An Appointment has a start_time and a end_time. I want to fetch appointments based on the time, so I want to get all appointments for a given day, for example. Since app engine doesn't support inequality query based on two fields, what can I do?
pydev with eclipse does create test database when running test
12,535,217
1
0
234
0
python,django,pydev
The Django test runner can be accessed by creating a new (Run or Debug) configuration for your project using the Django template. Set your main module as manage.py and under the Arguments tab enter "test" (or any other manage.py arguments you need).
0
0
0
1
2012-09-21T14:24:00.000
1
1.2
true
12,532,465
0
0
1
1
It is a django project. I am using pydev 2.6. How do I make it to use the Django test runner?
Python Audio library for fast, gapless looping of many short audio tracks
31,437,197
0
4
1,335
0
python,audio,loops,playback
I am using PyAudio for a lot of things and are quite happy with it. If it can do this, I do not know, but I think it can. One solution is to feed sound buffer manually and control / set the needed latency. I have done this and it works quite well. If you have the latency high enough it will work. An other solution, similar to this, is to manage the latency your self. You can queue up and or mix your small sound files manually to e.g. sizes of 0.5 -1 sec. This will greatly reduce the requirement to the "realtimeness" and alow you to do some pretty cool transitions between "speeds" I do not know what sort of latency you can cope with, but if we are talking about train speeds, I guess they do not change instantaneous - hence latency of 500ms to several seconds is most likely acceptable.
0
0
0
1
2012-09-21T14:34:00.000
1
0
false
12,532,631
0
0
1
1
I'm writing an application to simulate train sounds. I got very short (0.2s) audio samples for every speed of the train and I need to be able to loop up to 20 of them (one for every train) without gaps at the same time. Gapless changing of audio samples (train speed) is also a Must-Have. I've been searching for possible python-audio-solutions, including PyAudio PyMedia pyaudiere but I'm not sure which one suits best my use-case, so I do really appreciate any propositions and experiences! PS: I did already try out gstreamer but since the 1.0 release is not there yet and I cant figure out how to get gapless playback to work with pygi, i thought there might be a better choice. I also tried pygame, but it seems like it's limited to 8 audio channels??
blueprint of blueprints (Flask)
24,216,134
3
6
6,797
0
python,web-services,web-applications,flask,blueprint
I wish the Blueprint object has a register_blueprint function just as the Flask object does. It would automatically place and registered blueprints under the current Blueprints' url.
0
0
0
0
2012-09-21T15:40:00.000
4
0.148885
false
12,533,745
0
0
1
1
I have a series of blueprints I'm using, and I want to be able to bundle them further into a package I can use as seamlessly as possible with any number of other applications. A bundle of blueprints that provides an entire engine to an application. I sort of created my own solution, but it is manual and requires too much effort to be effective. It doesn't seem like an extension, and it is more than one blueprint(several that provide a common functionality). Is this done? How? (Application dispatching methods of tying together several programs might work isn't what I'm looking for)
A web application to serve static files
12,546,511
3
0
402
0
python,django,apache,webserver,openshift
How about this: Use nginx to serve static files Keep the files in some kind of predefined directory structure, build a django app as the dashbord with the filesystem as the backend. That is, moving, adding or deleting files from the dashboard changed them the filesystem and nginx doesn't have to be aware of this dashboard. Do not use dynamic routing. Just layout and maintain the proper directory structure using the databoard. Optionally, keep the directory structure and file metadata in some database server for faster searches and manipulation. This should result in a very low overhead static file server.
0
0
0
0
2012-09-22T16:07:00.000
1
0.53705
false
12,545,418
0
0
1
1
I am thinking to design my own web app to serve static files. I just don't want to use Amazon services.. So, can anyone tell me how to start the project? I am thinking to develop in Python - Django on Openshift (Redhat's). This is how ideas are going through in my mind: A dashboard helps me to add/ delete/ manage static files To setup API kind of thing (end point: JSON objects) so that I can use this project to serve my web apps! As openshift uses Apache!, I am thinking to dynamically edit htaccess and serve the files.. but not sure whether it would be possible or not Or, I can use django's urls.py to serve the files but I don't think djano is actually made for. Any ideas and suggestion?
Flask-Babel -0 pybabel: error: unknown locale 'jp'
12,559,877
5
0
1,091
0
python,flask,python-babel,flask-babel
Babel does support Japanese and indeed, the error comes because 'jp' is not a valid locale. Babel uses language codes from CLDR (which I believe are the standardized language codes from ISO et al). In your case the confusion comes from the language/territory split ('de' for German language, 'AT' for Austrian territory, 'DE' for Germany, ...). The language code for Japanese is 'ja', territory is 'JP'. So you should use just 'ja' or 'ja_JP'.
0
0
0
0
2012-09-23T08:27:00.000
1
0.761594
false
12,550,810
1
0
1
1
I am having issues with Flask-babel. I cant create a translation for Japanese. pybabel: error: unknown locale 'jp' Is this a Flask-Babel issue? That is the same error when a language does not exists. But, german works. So.....babel does nit support Japanese? Is there an alternative to Babel that support a major language like Japanese?
Messed up records - separator inside field content
12,553,211
0
1
111
1
python,perl,language-agnostic
If you know what each field is supposed to be, perhaps you could write a regular expression which would match that field type only (ignoring tildes) and capture the match, then replace the original string in the file?
0
0
0
0
2012-09-23T14:36:00.000
2
0
false
12,553,197
0
0
1
1
I am provided with text files containing data that I need to load into a postgres database. The files are structured in records (one per line) with fields separated by a tilde (~). Unfortunately it happens that every now and then a field content will include a tilde. As the files are not tidy CSV, and the tilde's not escaped, this results in records containing too many fields, which cause the database to throw an exception and stop loading. I know what the record should look like (text, integer, float fields). Does anyone have suggestions on how to fix the overlong records? I code in per but I am happy with suggestions in python, javascript, plain english.
Celery Task Grouping/Aggregation
12,705,857
4
13
3,185
0
python,asynchronous,task,celery,aggregation
An easy way to accomplish this is to write all the actions a task should take on a persistent storage (eg. database) and let a periodic job do the actual process in one batch (with a single connection). Note: make sure you have some locking in place to prevent the queue from being processes twice! There is a nice example on how to do something similar at kombu level (http://ask.github.com/celery/tutorials/clickcounter.html) Personally I like the way sentry does something like this to batch increments at db level (sentry.buffers module)
0
1
0
0
2012-09-23T21:14:00.000
2
0.379949
false
12,556,309
0
0
1
1
I'm planning to use Celery to handle sending push notifications and emails triggered by events from my primary server. These tasks require opening a connection to an external server (GCM, APS, email server, etc). They can be processed one at a time, or handled in bulk with a single connection for much better performance. Often there will be several instances of these tasks triggered separately in a short period of time. For example, in the space of a minute, there might be several dozen push notifications that need to go out to different users with different messages. What's the best way of handling this in Celery? It seems like the naïve way is to simply have a different task for each message, but that requires opening a connection for each instance. I was hoping there would be some sort of task aggregator allowing me to process e.g. 'all outstanding push notification tasks'. Does such a thing exist? Is there a better way to go about it, for example like appending to an active task group? Am I missing something? Robert
User-generated Jinja 2 templates with Flask
12,561,340
1
6
576
0
python,flask,jinja2
If you allow users to upload arbitrary jinja2 templates, you allow them arbitrary html and javascript and thus become a web hosting company, with all the consequences. You also have to be careful with the variables you give them access to, so that private user data (if any) is kept separated from each other.
0
0
0
0
2012-09-24T07:56:00.000
2
0.099668
false
12,560,963
0
0
1
1
I am writing a web application where users can create their own designs. The easiest way to do this would be by allowing them to upload their own Jinja 2 templates. However, I’m concerned about the security. What are things I should be cautious for? Should I set a custom Jinja 2 environment for this?
Delete Server File When Exiting from Web Page
12,566,448
1
0
457
0
javascript,python,cgi
As Lajos Arpad wrote, you should send notification to the server when the page is unloaded (XmlHTTPRequest in onbeforeunload event for example); but beware, that it will not be bulletproof - for example if user resets his/her machine, or forces killing browser process ungracefully (unix kill -9 for example), the browser will cease to exist and will not send any notification to the server. Maybe in that case it would be the best to introduce some heartbeat, like the webpage sends XHR every 10 seconds, and if the server doesn't see any heartbeat in 5 minutes, it's likely that user died and the file should be deleted too.
0
0
0
0
2012-09-24T13:27:00.000
2
0.099668
false
12,566,049
0
0
1
2
Using a python cgi script and I have a form with both a Submit and Cancel button. When a user tries to leave the web page by clicking Cancel, closing the window or hitting the back button, I want to delete a file that exists on the server. The file name is dependent on the values in the form. When the user clicks the Submit button, no file will be deleted. The form action is to take the user to another python cgi script. I can catch the user leaving the page with javascript onbeforeunload event, but I can't delete the files in javascript. How do I delete the files?
Delete Server File When Exiting from Web Page
12,566,229
0
0
457
0
javascript,python,cgi
You can't access server files using Javascript because of security reasons. However, you can make a postback in the onbeforeunload event and on the server-side event (which handles this postback) you can delete the server file(s) to be deleted.
0
0
0
0
2012-09-24T13:27:00.000
2
1.2
true
12,566,049
0
0
1
2
Using a python cgi script and I have a form with both a Submit and Cancel button. When a user tries to leave the web page by clicking Cancel, closing the window or hitting the back button, I want to delete a file that exists on the server. The file name is dependent on the values in the form. When the user clicks the Submit button, no file will be deleted. The form action is to take the user to another python cgi script. I can catch the user leaving the page with javascript onbeforeunload event, but I can't delete the files in javascript. How do I delete the files?
Big mysql query versus an http post connection in terms of long term speed
12,568,898
1
0
34
0
python,mysql,django
It depends a lot on what you plan on doing with the data. However, thinking long term you're going to have much more flexibility with breaking out the friends into distinct units than just storing them all together. If the friend creation process is taking too long, you should consider off-loading it to a separate process that can finish it in the background, using something like Celery.
0
0
0
0
2012-09-24T16:01:00.000
1
1.2
true
12,568,725
0
0
1
1
right now I think i'm stuck between two main choices for grabbing a user's friends list. The first is a direct connection with facebook, and the pulling the friends list out and creating a list of friend models with the json. (Takes quite a while whenever I try it out, like 2 seconds?) The other is whenever a user logs in, the program will store his or her entire friends list inside a big friends model (note that even if two people have the same exact friends, two sets will still be stored, all friend models will have an FK back to the person who has these friends on their list). Whenever a user needs his or her friends list, I just use django's filter to grab them. Right now this is pretty fast but that's because it hasn't been tested with many people yet. Based off of your guys experience, which of these two decisions would make the most sense long term? Thank you
How to upload a file to S3 without creating a temporary local file
56,126,467
0
38
52,339
1
python,amazon-s3,amazon
Given that encryption at rest is a much desired data standard now, smart_open does not support this afaik
0
0
1
0
2012-09-24T18:09:00.000
12
0
false
12,570,465
0
0
1
2
Is there any feasible way to upload a file which is generated dynamically to amazon s3 directly without first create a local file and then upload to the s3 server? I use python. Thanks
How to upload a file to S3 without creating a temporary local file
12,570,568
2
38
52,339
1
python,amazon-s3,amazon
I assume you're using boto. boto's Bucket.set_contents_from_file() will accept a StringIO object, and any code you have written to write data to a file should be easily adaptable to write to a StringIO object. Or if you generate a string, you can use set_contents_from_string().
0
0
1
0
2012-09-24T18:09:00.000
12
0.033321
false
12,570,465
0
0
1
2
Is there any feasible way to upload a file which is generated dynamically to amazon s3 directly without first create a local file and then upload to the s3 server? I use python. Thanks
Options for Image Caching
12,585,067
1
0
717
0
python,google-app-engine,caching,distributed-caching,image-caching
Blobstore is fine. Just make sure you set the HTTP cache headers in your url handler. This allows your files to be either cached by the browser (in which case you pay nothing) or App Engine's Edge Cache, where you'll pay for bandwidth but not blobstore accesses. Be very careful with edge caching though. If you set an overly long expiry, users will never see an updated version. Often the solution to this is to change the url when you change the version.
0
1
0
0
2012-09-24T22:40:00.000
3
0.066568
false
12,573,915
0
0
1
1
I am running a website on google app engine written in python with jinja2. I have gotten memcached to work for most of my content from the database and I am fuzzy on how I can increase the efficiency of images served from the blobstore. I don't think it will be much different on GAE than any other framework but I wanted to mention it just in case. Anyway are there any recommended methods for caching images or preventing them from eating up my read and write quotas?
Log in with Django-social-auth & tastypie on iOS
12,587,020
8
2
1,488
0
python,ios,django,api,django-socialauth
You cannot use django-social-auth directly. To do Facebook login, you need to use the Facebook SDK for iOS (https://developers.facebook.com/docs/reference/iossdk/). It will return you the access token which you would send to your API created using TastyPie. When you have the access token, you can register a new user based on that. Using the Facebook Graph API, you can get the user's name and other info. Make sure to save the access token so you can identify a returning user. After you register or login a user, return a "token" that is specific to that user. Your site generates the token. You'll use that token to communicate with your site.
0
0
0
0
2012-09-25T06:05:00.000
1
1.2
true
12,577,045
0
0
1
1
I'm building out an API using tastypie for an iOS app. I can handle normal authentication / authorization just fine but I'm a bit confused when it comes to using django-social-auth to register / login / link THROUGH Tastypie. If I'd, for example like to authenticate or register users on an iOS app using django-social-auth and tastypie, how would I go about that? Any suggestions? Am I looking at this the wrong way?
Hadoop Hbase query
21,502,085
0
0
1,019
1
java,python,hadoop,hbase,thrift
Phoenix is a good solution for low latency result from Hbase tables than Hive. It is good for range scans than Hbase scanners because they use secondary indexes and SkipScan. As in your case , you use Python and phoenix API have only JDBC connectors. Else Try Hbase Coprocessors. Which do SUM, MAX, COUNT,AVG functions. you can enable coprocessors while creating table and can USE the Coprocessor functions You can try Impala, which provide an ODBC connector, JDBC connector. Impala uses hive metatable for executing massively parallel batch execution. You need to create a Hive metatable for your Hbase Table.
0
0
0
0
2012-09-25T14:35:00.000
3
0
false
12,585,286
0
0
1
1
I have the below setup 2 node hadoop/hbase cluster with thirft server running on hbase. Hbase has a table with 10 million rows. I need to run aggregate queries like sum() on the hbase table to show it on the web(charting purpose). For now I am using python(thrift client) to get the dataset and display. I am looking for database(hbase) level aggregation function to use in the web. Any thoughts?
Is there a curated repository for DJango based website templates?
12,590,919
1
2
1,017
0
python,django
There's no similar "themes" for Django like you'd find for Wordpress. Wordpress is a CMS -- a full application -- whereas Django is a framework -- i.e., you could use it to build a Wordpress, but it is not a Wordpress. You could start off with a pure HTML/CSS template and use that to build in functionality, but you won't find anything Django-specific, because it would inherently depend on what you build.
0
0
0
0
2012-09-25T20:24:00.000
2
0.099668
false
12,590,492
0
0
1
1
Where can I find a list of (preferably curated) DJango based, simple-website, templates (or equivalent, prewritten, boilerplate DJango code and layout)? Context I'm considering a project which requires me to deploy a large number of (fairly simple) personal/vanity websites. They are simple enough that, most likely, I should be able to deploy them as Wordpress based websites, using a few existing templates. However, I'm not a fan of Wordpress, and I'd like to see if I can get roughly the same result by working with Python/DJango.
How does HTML templating fit in with the backend language and database?
12,594,044
0
1
160
0
javascript,python,templates,web-applications
There are obviously many ways this can all work together, but it sounds like you have the (a) right idea. Generally the frontend deals with JSON, and the server provides JSON. What's consuming or providing those responses is irrelevant; you shouldn't need to worry that Mongo is your database, or that underscore is handling your templates. Think of your frontend and backend as two totally separate applications (this is pretty much true). Ignore the fact that your frontend code and templates are probably delivered from the same machine that's handling the backend. Your backend is in the business of persisting data, and your frontend in the business of displaying it. RE: Mongo using JSON/BSON; The fact it uses the same language as your frontend to communicate is a red herring. Your DB layer should abstract this away anyway, so you're just using Python dicts/tuples/etc to talk to the database. I'm guessing i'd have to have a python script that pulls the information from the DB, create a JSON object, and use it to populate the fields in the html template. Spot on :)
0
0
0
0
2012-09-26T01:58:00.000
1
1.2
true
12,593,541
0
0
1
1
I apologize if this question is not specific enough, but I do need some help understanding this concept. I've been researching many Javascript libraries including JQuery, MooTools, Backbone, Underscore, Handlebars, Mustache, etc - also Node.js and Meteor (I know all those serve different purposes). I have a basic idea of what each does, but my question is mainly focused on the templating libraries. I think the general idea is that the template will be filled by a JSON object that's retrieved from the server. However, i'm confused by how that JSON object is formed, and if it can go the other way to the backend to update the database. Please correct me if this is incorrect. For a more solid example, let's say I have Apache running on Linux, and am using MongoDB as the database and python as my primary language. How do all these components interact with the templating library and each other? For example, if I have an HTML file with a form in it and the action will be set to some python script; will that script have to retrieve the fields, validate them, and then update them in the DB? If it's MySQL I'd have to write a SQL statement to update it, but with Mongo wouldn't it be different/easier since it's BSON/JSON based? And for the other example, let's say I have a view-account.html page that will need to pull up user information from the DB, in what form will it pull the information out and how will it fill it into the template? I'm guessing i'd have to have a python script that pulls the information from the DB, create a JSON object, and use it to populate the fields in the html template. I am aware there are web frameworks that will ease this process, and please suggest any that you would recommend; however, I'm really interested in understanding the concepts of how these components interact. Thanks!!
Deploying Flask, parallel requests
12,620,810
4
6
2,708
0
python,flask,wsgi
I use uWSGI with the gevent loop. That is the ticket. In fact, this is how I use py-redis which is blocking to not be blocking. Also, I use uWSGI to write requests after the response while still accepting more requests.
0
0
0
0
2012-09-27T11:48:00.000
3
1.2
true
12,620,695
0
0
1
1
When I test my new Flask application with the built in web server, everything is "single threaded" and blocking. The server can not serve one request without finishing another. It can only process one request at a time. When deploying a web service, this is obviously not desirable. How do you deploy Flask applications so that things can move in parallel? Are there different things to consider regarding thread safety and concurrency inside the code (protect objects with locks and so on) or are all the offerings equivalent?
Moving nodes from one tree to another with Dynatree
12,659,689
0
1
908
0
python,django,dynatree
There is a difference between 'selected' and 'active'. Selection is typically done using checkboxes, while only one node can be activated (typically by a mouse click). A 2nd click on an active node will not fire an 'onActivate' event, but you can implement the 'onClick' handler to catch this and call node.deactivate()
0
0
0
0
2012-09-28T09:00:00.000
3
0
false
12,636,812
0
0
1
3
I'm currently working on a django project and i'm using dynatree to build treeview. I have two trees, first tree has items that user can select and the selected items will be moved to second tree. Is there a way that I can do so in dynatree?And there's an option for user to "unselect" the item so the selected item will move back to the first tree. So when user unselect the item, how can i move the item back to its original parent node? Thanks in advance..
Moving nodes from one tree to another with Dynatree
19,162,943
1
1
908
0
python,django,dynatree
I have a dynamTree on a DIV dvAllLetterTemplates (which contains a master List) and a DIV dvUserLetterTemplates to which items are to be copied. //Select the Parent Node of the Destination Tree var catNode = $("#dvUserLetterTemplates").dynatree("getTree").selectKey(catKey, false); if (catNode != null) { //Select the source node from the Source Tree var tmplNode = $("#dvAllLetterTemplates").dynatree("getTree").selectKey(arrKeys[i], false); if (tmplNode != null) { //Make a copy of the source node var ndCopy = tmplNode.toDict(false, null); //Add it to the parent node catNode.addChild(ndCopy); //Remove the source node from the source tree (to prevent duplicate copies tmplNode.remove(); //Refresh both trees $("#dvUserLetterTemplates").dynatree("getTree").redraw(); $("#dvAllLetterTemplates").dynatree("getTree").redraw(); } }
0
0
0
0
2012-09-28T09:00:00.000
3
0.066568
false
12,636,812
0
0
1
3
I'm currently working on a django project and i'm using dynatree to build treeview. I have two trees, first tree has items that user can select and the selected items will be moved to second tree. Is there a way that I can do so in dynatree?And there's an option for user to "unselect" the item so the selected item will move back to the first tree. So when user unselect the item, how can i move the item back to its original parent node? Thanks in advance..
Moving nodes from one tree to another with Dynatree
15,516,606
2
1
908
0
python,django,dynatree
I've solved my problem using the copy/paste concept of context menu. And for the second problem, I used global variable to store the original parent node so when user unselect the item, it will move back to its original parent.
0
0
0
0
2012-09-28T09:00:00.000
3
1.2
true
12,636,812
0
0
1
3
I'm currently working on a django project and i'm using dynatree to build treeview. I have two trees, first tree has items that user can select and the selected items will be moved to second tree. Is there a way that I can do so in dynatree?And there's an option for user to "unselect" the item so the selected item will move back to the first tree. So when user unselect the item, how can i move the item back to its original parent node? Thanks in advance..
Storing text files > 1MB in GAE/P
12,648,928
1
2
223
0
python,google-app-engine,google-docs-api,blobstore,google-cloud-storage
If you're already using the Files API to read and write the files, I'd recommend you use Google Cloud Storage rather than the Blobstore. GCS offers a richer RESTful API (makes it easier to do things like access control), does a number of things to accelerate serving static data, etc.
0
1
0
0
2012-09-28T12:52:00.000
3
0.066568
false
12,640,409
0
0
1
2
I have a Google App Engine app where I need to store text files that are larger than 1 MB (the maximum entity size. I'm currently storing them in the Blobstore and I make use of the Files API for reading and writing them. Current operations including uploading them from a user, reading them to process and update, and presenting them to a user. Eventually, I would like to allow a user to edit them (likely as a Google doc). Are there advantages to storing such text files in Google Cloud Storage, as a Google Doc, or in some other location instead of using the Blobstore?
Storing text files > 1MB in GAE/P
12,641,339
0
2
223
0
python,google-app-engine,google-docs-api,blobstore,google-cloud-storage
Sharing data is more easy in Google Docs (now Google Drive) and Google Cloud Storage. Using Google drive u can also use the power of Google Apps scripts.
0
1
0
0
2012-09-28T12:52:00.000
3
0
false
12,640,409
0
0
1
2
I have a Google App Engine app where I need to store text files that are larger than 1 MB (the maximum entity size. I'm currently storing them in the Blobstore and I make use of the Files API for reading and writing them. Current operations including uploading them from a user, reading them to process and update, and presenting them to a user. Eventually, I would like to allow a user to edit them (likely as a Google doc). Are there advantages to storing such text files in Google Cloud Storage, as a Google Doc, or in some other location instead of using the Blobstore?
Installing a django site on GoDaddy
12,659,723
3
32
61,875
0
python,django,installation
I am not familiar with GoDaddy's setup specifically, but in general, you cannot install Django on shared hosting unless it is supported specifically (a la Dreamhost). So unless GoDaddy specifically mentions Django (or possibly mod_wsgi or something) in their documentation, which is unlikely, you can assume it is not supported. Theoretically you can install Python and run Django from anywhere you have shell access and sufficient permissions, but you won't be able to actually serve your Django site as part of your shared hosting (i.e., on port 80 and responding to your selected hostname) because you don't have access to the webserver configuration. You will need either a VPS (GoDaddy offers them but it's not their core business; Linode and Rackspace are other options), or a shared host that specifically supports Django (e.g. Dreamhost), or an application host (Heroku or Google App Engine). I recommend Heroku personally, especially if you are not confident in setting up and maintaining your own webserver.
0
0
0
0
2012-09-30T03:39:00.000
5
0.119427
false
12,658,427
0
0
1
1
I have never deployed a Django site before. I am currently looking to set it up in my deluxe GoDaddy account. Does anyone have any documentation on how to go about installing python and django on GoDaddy?
Pyramid app not releasing memory between views
12,673,353
2
3
223
0
pyramid,pickle,python-3.2
Pyramid's debug toolbar keeps objects alive. Deactivating it fixes most memory leak problems. The leak that was the cause of my searching for errors in Pyramid doesn't seem to be a problem with Pyramid at all
0
0
0
0
2012-09-30T10:24:00.000
1
1.2
true
12,660,516
0
0
1
1
I've got a Pyramid view that's misbehaving in an interesting way. What the view does is grab a pretty complex object hierarchy from a file (using pickle), does a little processing, then renders an html form. Nice and simple. Setup: I'm running Ubuntu 12.04 64bit, Python3.2, Pyramid 1.3.3, SQLAlchemy 0.7.8 and using the standard waitress server. Symptoms I was having some efficiency issues so used system monitor to try to see what was up and found that while pyramid is doing its processing and suchlike for the view I described my ram usage rose steadily. As the html form was displayed in my browser the ram usage leveled off but didn't fall. Reloading the view caused the ram usage to grow steadily from where it left off. If I keep doing this all my ram is used up and everything grinds to a halt. If I kill the server then the ram usage drops back down immediately. Question What's going on? It's obvious that memory isn't being released between view renderings, but why is this happening? And how can I make it stop? I even tried calling del on stuff before returning from the view and nothing changed.
Scheduling update functions in Django and Heroku?
12,664,898
0
0
164
0
python,django,heroku,celery
Based on you use case description you do not need a Scheduler, so APScheduler will not match your requirements well. Do you have a web dyno besides your worker dyno? The usual design pattern for this type of processing is to set up a control thread or control process (your web dyno) that accepts requests. These requests are then placed on a request queue. This queue is read by one or more worker threads or worker processes (you worker dyno). I have not worked with Celery, but it looks like a match with your requirements. How many worker threads or worker dyno's you will need is difficult to determine based on your description. You will need to specify also how many requests for updates you will need to process per second. Also, you will need to specify if the request is CPU bound or IO bound.
0
0
0
0
2012-09-30T20:11:00.000
1
0
false
12,664,713
0
0
1
1
I am working on a project, to be deployed on Heroku in Django, which has around 12 update functions. They take around 15 minutes to run each. Let's call them update1(), update2()...update10(). I am deploying with one worker dyno on Heroku, and I would like to run up to n or more of these at once (They are not really computationally intensive, they are all HTML parsers, but the data is time-sensitive, so I would like them to be called as often as possible). I've read a lot of Celery and APScheduler documentation, but I'm not really sure which is the best/easiest for me. Do scheduled tasks run concurrently if the times overlap with one another (ie. if I run one every 2 minutes, and another every 3 minutes, or do they wait until each one finishes?) Any way I can queue these functions, so at least a few of them are running at once? What is the suggested number of simultaneous calls for this use-case?
How to modify the url in plone so that we don't get the same page if it is modified?
12,671,365
5
0
298
0
python,plone
In the example above, sample.pdf is presumably a File created in Plone. In this case, the URL without /view will render the file for download, and the URL with /view will render a Plone page with a link to download it. This is standard behaviour. It isn't really possible to stop people from downloading the PDF. You can modify the File FTI in portal_types (go to portal_types/File in the ZMI and change the method aliases tab). If you change the "(Default)" alias to be the same as the "view" one, it will behave the same. Note that this will affect all files. Martin
0
0
0
0
2012-10-01T06:54:00.000
1
1.2
true
12,668,710
0
0
1
1
After using atreal.richfile.preview in plone, we get the preview of a pdf file with the url like : http://localhost:8090/plone/sample.pdf/view. If we delete part of the url i.e "/view", and enter the url: http://localhost:8090/plone/sample.pdf in the browser, it still can be viewed and the pdf becomes printable or can be copied. How can I modify the url so that it will not display the pdf in the new window if the url of the same is modified? Using plone 4.1. Which template and what code needs to be added/ edited. Please guide
What are the non-obvious problems you encounter, moving from Django to Flask?
12,674,458
1
0
170
0
python,django,web-services,web-applications,flask
I tend to use Django for "big" projects and Flask for projects requiring less than a ~300 lines file. The challenges in moving to Flask are in my sense to go look for the extensions for forms, mails, databases... When you need them, and referring to different documentations. But it is naturally the price of flexibility. One of the key issue I have been facing was deployment with Fabric. I was used to deploy very quickly with django-fab-deploy and it tooks me a little bit of time to set up a comparable generic deployment solution for Flask.
0
0
0
0
2012-10-01T07:33:00.000
1
0.197375
false
12,669,115
0
0
1
1
Question is for programmers who have used Django and Flask for real projects. What challenges do you face going to the Flask? Interested in the situation when there may be unexpected difficulties (after using django). Specific examples are welcome.
Tastypie: Add meta codes to dispatch_list
12,686,954
1
0
883
0
python,django,api,rest,tastypie
You can add a new field to the resource and dehydrate it with dehydrate_field_name().
0
0
0
1
2012-10-02T02:08:00.000
2
1.2
true
12,683,630
0
0
1
1
How can I add custom fields (in this case, meta codes) to a dispatch_list in Tastypie?
Easiest way to tackle this web crawling task?
12,697,280
1
3
321
0
c++,python,ruby-on-rails,web-applications,web-crawler
Adding to mechanize: if your page has a javascript component that mechanize cant handle, selenium drives an actual web browser. If you're hellbent on using ruby, you can also use WATIR, but selenium has both ruby and python bindings.
0
0
1
0
2012-10-02T15:08:00.000
3
0.066568
false
12,693,054
0
0
1
2
I currently have been assigned to create a web crawler to automate some reporting tasks I do. This web crawler would have to login with my credentials, search specific things in different fields (some in respect to the the current date), download CSVs that contain the data if there is any data available, parse the CSVs quickly to get a quick number count, create an email with the CSVs attached and send it. I currently know C++ and Python very well, am in the process of learning C, but I was told that Ruby or Ruby on Rails was a great way to do this. Is Ruby on Rails solely for creating web apps, and if so, does my task fit the description of a web app, or can I just make a standalone program that runs and does it all? I would like to know which language would be the easiest to code with (has easy to use modules), has a good library/module relative to these tasks. What would I need to take into account before undergoing this task? I have till the end of December to make this, and I only work here for around 12 hours per week (I'm a student, and this is for my internship). Is this feasible? Thanks.
Easiest way to tackle this web crawling task?
12,693,218
0
3
321
0
c++,python,ruby-on-rails,web-applications,web-crawler
While this is not a great Stackoverflow question, since you are a student and it's for an internship, it seems like it would be in poor form to flag it, or down-vote it. :) Basically, you can pretty much accomplish this task with any of the languages you listed. If you want learning Ruby as a part of your experience for your internship, then this might be a great project and a way of learning it. But, python would work great, also (you could probably use Mechanize). I should probably disclose that I'm a Python developer and I love it. I think it's a great language with great support and tools. I'm sure the Ruby guys feel the same about their language. Again, I think it's what you want to try to accomplish during your internship. What experience do you want to take away, etc. Best of luck.
0
0
1
0
2012-10-02T15:08:00.000
3
0
false
12,693,054
0
0
1
2
I currently have been assigned to create a web crawler to automate some reporting tasks I do. This web crawler would have to login with my credentials, search specific things in different fields (some in respect to the the current date), download CSVs that contain the data if there is any data available, parse the CSVs quickly to get a quick number count, create an email with the CSVs attached and send it. I currently know C++ and Python very well, am in the process of learning C, but I was told that Ruby or Ruby on Rails was a great way to do this. Is Ruby on Rails solely for creating web apps, and if so, does my task fit the description of a web app, or can I just make a standalone program that runs and does it all? I would like to know which language would be the easiest to code with (has easy to use modules), has a good library/module relative to these tasks. What would I need to take into account before undergoing this task? I have till the end of December to make this, and I only work here for around 12 hours per week (I'm a student, and this is for my internship). Is this feasible? Thanks.
south migration making incorrect initial schemamigration
12,697,732
1
0
91
0
python,django,migration,django-south
--initial is not about detecting changes, you shouldn't expect it to. It takes the current state of the tables and exports them as create table statements to get your first migration off the ground such that on a new install, you simply run "python manage.py migrate" to build your tables from start to finish. No matter how many times you run --initial, it will generate these migrations with full table output. Again, it is not about detecting anything - it simply outputs the current state of the tables and is intended to be used as the "intitial/first" migration.
0
0
0
0
2012-10-02T20:16:00.000
1
1.2
true
12,697,595
0
0
1
1
I'm trying to run migration by south, But when I run : manage.py schemamigration <my_app> --initial it makes wrong modifications, creating "Added model treinoclub_app.Endereco Added model treinoclub_app.Academia". But I didn't make any changes for this table.
How to debug Celery/Django tasks running locally in Eclipse
19,998,790
1
29
23,443
0
python,eclipse,celery
I create a management command to test task.. find it easier than running it from shell..
0
1
0
0
2012-10-02T20:57:00.000
5
0.039979
false
12,698,212
0
0
1
1
I need to debug Celery task from the Eclipse debugger. I'm using Eclipse, PyDev and Django. First, I open my project in Eclipse and put a breakpoint at the beginning of the task function. Then, I'm starting the Celery workers from Eclipse by Right Clicking on manage.py from the PyDev Package Explorer and choosing "Debug As->Python Run" and specifying "celeryd -l info" as the argument. This starts MainThread, Mediator and three more threads visible from the Eclipse debugger. After that I return back to the PyDev view and start the main application by Right Click on the project and choosing Run As/PyDev:Django My issues is that once the task is submitted by the mytask.delay() it doesn't stop on the breakpoint. I put some traces withing the tasks code so I can see that it was executed in one of the worker threads. So, how to make the Eclipse debugger to stop on the breakpoint placed withing the task when it executed in the Celery workers thread?
Django: using {{STATIC_URL}} from python side
12,865,154
0
0
148
0
python-2.7,django-views,django-1.3
As zzzirk says: Django really isn't about flat pages, so the most Djangonic solution is to put flat pages beside the django app, not within it.
0
0
0
0
2012-10-03T00:27:00.000
2
0
false
12,700,350
0
0
1
2
Building a "history" system that serves static pages based on the date the user asks for. Not all dates have associated pages, and it isn't possible to know, based on what's in the database which do, which don't. I haven't been able to find a way to redirect to a static page because there doesn't seem to be any way to capture the value of the {{STATIC_URL}} tag on the python side. I have got some code that depends on the static file being on the same file system as the django server, but that is clearly wrong. I have two needs: 1: how can I (redirect?) to the static page(s) from my views.py file? 2: how can I query for the existence of a particular one of those static pages?
Django: using {{STATIC_URL}} from python side
12,739,819
0
0
148
0
python-2.7,django-views,django-1.3
I'm not certain from your question if you understand the intention of the {{ STATIC_URL }} tag. It is a URL prefix for static content files such as css, javascript, or image files. It is not intended as a path for your own static HTML files. In the end I'm not sure you are asking the right question for what you are wanting to accomplish.
0
0
0
0
2012-10-03T00:27:00.000
2
0
false
12,700,350
0
0
1
2
Building a "history" system that serves static pages based on the date the user asks for. Not all dates have associated pages, and it isn't possible to know, based on what's in the database which do, which don't. I haven't been able to find a way to redirect to a static page because there doesn't seem to be any way to capture the value of the {{STATIC_URL}} tag on the python side. I have got some code that depends on the static file being on the same file system as the django server, but that is clearly wrong. I have two needs: 1: how can I (redirect?) to the static page(s) from my views.py file? 2: how can I query for the existence of a particular one of those static pages?
Boto reverse the stream
12,716,129
3
4
636
1
python,stream,twisted,boto
boto is a Python library with a blocking API. This means you'll have to use threads to use it while maintaining the concurrence operation that Twisted provides you with (just as you would have to use threads to have any concurrency when using boto ''without'' Twisted; ie, Twisted does not help make boto non-blocking or concurrent). Instead, you could use txAWS, a Twisted-oriented library for interacting with AWS. txaws.s3.client provides methods for interacting with S3. If you're familiar with boto or AWS, some of these should already look familiar. For example, create_bucket or put_object. txAWS would be better if it provided a streaming API so you could upload to S3 as the file is being uploaded to you. I think that this is currently in development (based on the new HTTP client in Twisted, twisted.web.client.Agent) but perhaps not yet available in a release.
0
1
1
0
2012-10-03T18:54:00.000
2
1.2
true
12,714,965
0
0
1
1
I have a server which files get uploaded to, I want to be able to forward these on to s3 using boto, I have to do some processing on the data basically as it gets uploaded to s3. The problem I have is the way they get uploaded I need to provide a writable stream that incoming data gets written to and to upload to boto I need a readable stream. So it's like I have two ends that don't connect. Is there a way to upload to s3 with a writable stream? If so it would be easy and I could pass upload stream to s3 and it the execution would chain along. If there isn't I have two loose ends which I need something in between with a sort of buffer, that can read from the upload to keep that moving, and expose a read method that I can give to boto so that can read. But doing this I'm sure I'd need to thread the s3 upload part which I'd rather avoid as I'm using twisted. I have a feeling I'm way over complicating things but I can't come up with a simple solution. This has to be a common-ish problem, I'm just not sure how to put it into words very well to search it
How to set the content type header in response for a particular file type in Pyramid web framework
26,917,124
1
4
1,474
0
python,pyramid
Simply add this following code where your Pyramid web app gets initialized. import mimetypes mimetypes.add_type('application/x-font-woff', '.woff') For instance, I have added it in my webapp.py file, which gets called the first time the server gets hit with a request.
0
0
0
1
2012-10-04T08:13:00.000
2
0.099668
false
12,723,009
0
0
1
1
I am using pyramid web framework to build a website. I keep getting this warning in chrome console: Resource interpreted as Font but transferred with MIME type application/octet-stream: "http:static/images/fonts/font.woff". How do I get rid of this warning message? I have configured static files to be served using add_static_view I can think of a way to do this by adding a subscriber function for responses that checks if the path ends in .woff and setting the response header to application/x-font-woff. But it does not look like a clean solution. Is there a way to tell Pyramid to do it through some setting.
Including common Django Project in multiple projects
12,728,830
1
1
1,451
0
python,django
I would separate out the common models, ect... into it's own python package. Then each project will have this package installed, or just install the package at the system level and they both can use it. If you handle this properly you shouldn't have to change much of your imports and you can easily update the package by pushing a new egg to the server and installing via easy_install or pip. This is the way that I currently have my projects setup. Common non-business logic is separated out into their own project and I create a package from this and then install and use like any other python library. The little bit of extra work here can save you a lot of time and allows for transparent updating of your common code between various projects as well.
0
0
0
0
2012-10-04T13:39:00.000
3
1.2
true
12,728,547
0
0
1
1
I have two Django Projects where I use a lot of common models. Custom user classes, Algorithm classes, Product classes. The two projects are related to e-commerce, both run on different machines and serve completely different purposes. However, considering that they have these models in "common", I was wondering if it would be worth it to create a third, common project that serves as the "base" with the base models, and then both of these projects would import the common models from this base project. This would also help as we can join the two different customer and product databases from both e-commerce websites into this big common database. My questions are: 1) Does anybody have any experience with the possible overhead or can realistically estimate it? Joining the common parts of both Django projects will be necessary down the road, but I estimate there will be a lot of overhead in importing a third project (possibly in real-time). 2) What would be the best approach to importin this third project? I can think of multiple ways: Creating a packaged, installable Python module such as the existing ones on the internet (setuptools, lxml, tastypie) and importing that module into both Django projects; Having the project sit on a directory in a machine and importing from that path in real-time inside the Python file (have done it before, works but seems to have some overhead); EDIT: Our common models/functionality, additionally, contain trade-secreted and patenteable content, therefore public distribution is out of the question. I am guessing the route would be to create something like a package, but not publicly distributed, only distributed and installed on the 2 specific machines. Can anybody give some feedback on this? Thank you
Automate translation for personal use
16,074,293
0
0
184
0
python,web-scraping,translation
Or go to MicrosoftTranslator.com, and paste your text in one box, have it translate and cut and paste the result? Failing that, the MS Translator API can be used for up to 2 million characters a month for free...so maybe use that?
0
0
1
0
2012-10-04T15:14:00.000
3
0
false
12,730,426
0
0
1
1
I would like to translate a few hundred words for an application I'm writing. This is a simple, one-off project, so I'm not willing to pay for the the google translate API. Is there another web service which will do this? Another idea is to just send a search to Google, and scrape the result from the first result. For example, google 'translate food to spanish'. However, the page is a mess of obfuscated javascript, and I would need help scraping the result. I think python would be good for this, but any language will do.
Can I used simple sql commands in django
12,740,533
1
0
77
1
python,sql,django,django-queryset
Try this. https://docs.djangoproject.com/en/dev/topics/db/sql/
0
0
0
0
2012-10-05T06:05:00.000
2
0.099668
false
12,740,424
0
0
1
1
I want to select data from multiple tables, so i just want to know that can i used simple SQL queries for that, If yes then please give me an example(means where to use these queries and how). Thanks.
Passing JSON (dict) vs. Model Object to Templates in Django
12,750,335
2
0
662
0
python,django
Converting this to a model objects doesn't require storing it in database. Also if you are sure you don't want to store it maybe placing it in models.py and making it Django models is wrong idea. Probably it should be just normal Python classes e.g. in resources.py or something like that, not to mistake it with models. I prefer such way because maybe converting is slower (very tiny) but it allows to add not only custom constructor but others methods and properties as well which is very helpful. It also is just convenient and organizes stuff when you use normal classes and objects.
0
0
0
0
2012-10-05T15:45:00.000
2
1.2
true
12,749,702
0
0
1
1
Question In Django, when using data from an API (that doesn't need to be saved to the database) in a view, is there reason to prefer one of the following: Convert API data (json) to a json dictionary and pass to the template Convert API data (json) to the appropriate model object from models.py and then pass that to the template What I've Considered So Far Performance: I timed both approaches and averaged them over 25 iterations. Converting the API response to a model object was slower by approximately 50ms (0.4117 vs. 0.4583 seconds, +11%). This did not include timing rendering. Not saving this data to the database does prevent me from creating many-to-many relationships with the API's data (must save an object before adding M2M relationships), however, I want the API to act as the store for this data, not my app DRY: If I find myself using this API data in multiple views, I may find convenience in putting all my consumption/cleaning/etc. code in the appropriate object __init__ in models. Thanks very much in advance.
Android apps with Dojo and geodjango
12,750,812
0
1
197
0
android,python,django,dojo
I suggest to take a look at PhoneGap. I use it to embed JQuery mobile inside a Android application. PhoneGap makes it easy to embed javascript inside an Android application. Just try the PhoneGap tutorial. Edit: PhoneGap let u use the GPS sensor through javascript
1
0
0
0
2012-10-05T16:53:00.000
1
1.2
true
12,750,731
0
0
1
1
I am trying to make a android apps using Dojo toolkit and GeoDjango. Its a project based on GPS work. Can anyone help in this issue? I want to have the staring steps? I have some source code and SDK installed in my computer. But still confused about the staring. can Anyone help? How I will make it possible to create the apps. Steps plz?
How to Access files on Heroku?
38,451,714
4
9
9,743
0
python,heroku
You can run heroku run bash and backup the file then deploy your app run heroku run bash again and remove the new file and replace it with the old one you backed up. Hope it helps
0
0
0
0
2012-10-06T20:13:00.000
3
0.26052
false
12,763,440
1
0
1
1
I have a project on Heroku. This project allows me to update a JSON file. If update something on Heroku via the project's web interface I see the update. I can close the browser, open it again and the update persists. Now, I want to push something to this project. If I do, the JSON file will be overwritten. So, I pulled first to get the current project state from heroku. Heroku's prompt says that everything is up to date, which is not true since I changed the JSON file. Using heroku run ls static/json/ shows the changed file. I need to get this file before pushing to heroku to avoid destroying updates done via the web interface.
Web2Py - Custom File Upload Form with Crud
21,023,517
0
1
764
0
python,web2py
I think you should attack one thing at the time and, for each one, try paste some code that helps a lot. I try to answer the last question: I think you won't be able to do that with crud interface without change the inner code (DO NOT DO THAT!). With SQLFORM, you can, altering CSS on Fields. But, the best and more controllable, although more hard work, is creating custom forms.
0
0
0
0
2012-10-06T20:56:00.000
1
0
false
12,763,814
0
0
1
1
I'm creating a custom file upload form in Web2Py, and was hoping some more experienced users could help me solve a few issues. Basically, the database ("t_file") is defined in "db_wizard.py", and in the controller, I'm calling crud.create(db.t_file, next=URL('upload')); a form is added in the html file with {{form}}. There are about a dozen fields created, two of which are selectors, one is a file upload/browse field, and the rest are input boxes. I would like to make the following changes: -Currently, the selectors default to an empty option. They are defined in the DB file like this: Field('f_data_real_or_fabricated_bool', 'list:string', requires=IS_IN_SET(['T','F']), label=T('Real or Fabricated')), However. when displayed, the first option is empty, and the two other options are below the empty option. Is there a way to get rid of the empty option? -The regular text input boxes, the selector boxes, and the filename input box are different widths. What is the best way to make them the same width? I've been trying all sorts of things with the CSS, but can't seem to get it. -Is there a way to use expandable text boxes for some of text input areas? -I would like the first several input fields to be required, and the rest to be optional. The mandatory fields should appear on the upload page by default, and the rest optional fields should only appear when an "advanced fields" (something along those lines) checkbox is checked. What is the best way to do this? Can the above changes be made by sticking with the crud.create or crud.* methods, without designing custom forms?
Flask request.remote_addr is wrong on webfaction and not showing real user IP
12,770,986
4
33
42,164
0
python,flask,webfaction
The problem is there's probably some kind of proxy in front of Flask. In this case the "real" IP address can often be found in request.headers['X-Forwarded-For'].
0
0
1
0
2012-10-07T17:09:00.000
5
0.158649
false
12,770,950
0
0
1
1
I just deployed a Flask app on Webfaction and I've noticed that request.remote_addr is always 127.0.0.1. which is of course isn't of much use. How can I get the real IP address of the user in Flask on Webfaction? Thanks!
Django - How does order_by work?
12,775,949
14
8
16,934
0
python,django,postgresql,sql-order-by
order_by can have multiple params, I think order_by('score', '-create_time') will always return the same queryset.
0
0
0
0
2012-10-08T05:34:00.000
3
1.2
true
12,775,844
0
0
1
1
I'd like to know how Django's order_by works if the given order_by field's values are same for a set of records. Consider I have a score field in DB and I'm filtering the queryset using order_by('score'). How will records having the same values for score arrange themselves? Every time, they're ordered randomly within the subset of records having equal score and this breaks the pagination at client side. Is there a way to override this and return the records in a consistent order? I'm Using Django 1.4 and PostgreSQL.
Is it possible to return (stream) a response (xml) from django as the output is rendering?
12,778,355
0
1
445
0
python,django,dhtmlx
Turns out you can't do this with templates, and so you have to move over to HttpResponces and building up your return manually, which may not be worth it for a lot of people.
0
0
0
0
2012-10-08T08:38:00.000
1
1.2
true
12,778,033
0
0
1
1
I have a page, which returns 10,000+ records as XML, which takes 7 seconds to return which i'm happy with, as most of it isn't displayed until the user scrolls down. But my front end has to wait 7 seconds for django to return anything so it can start showing the output, DHTMLX is able to render as data is being received so i was wondering if django can do this and how would I go about it? tl:dr; I want Django to respond as it renders output, can it? if so How?
Combining Tornado and Flask templates
12,786,744
2
0
394
0
python,routes,flask,tornado
Tornado templates uses syntax similar to Jinja, but the rendering engine is not Jinja. You might be able to get away with it, but then you would have to keep track of which templates are Jinja and which are Tornado. For the sake of sanity, just keep them separate.
0
0
0
0
2012-10-08T17:35:00.000
2
0.197375
false
12,786,680
0
0
1
2
Is possible to combine Tornado and Flask web templates together? For example: Use Index.html as "base" template setting up block for extensions: Then ,extend index with "block" from Flask for Flask Routes Then, extend index with "block" from Tornado for Tornado Routes..
Combining Tornado and Flask templates
12,859,244
1
0
394
0
python,routes,flask,tornado
You are not bound to the default template engine in Flask. Maybe you could somehow use Tornado's template engine in Flask, then it'd be possible to use the templates in both.
0
0
0
0
2012-10-08T17:35:00.000
2
0.099668
false
12,786,680
0
0
1
2
Is possible to combine Tornado and Flask web templates together? For example: Use Index.html as "base" template setting up block for extensions: Then ,extend index with "block" from Flask for Flask Routes Then, extend index with "block" from Tornado for Tornado Routes..
Web2Py - Validate uploaded file by email
12,809,067
0
0
262
0
python,web2py
In your table that contains the upload information, add a new string field called 'validation_key'. When a file is uploaded, insert a GUID or reasonably long alpha-numeric string in it. Send this key as part of the link in the email. When the user clicks the link, search for the key and if found, set the matched 'validation_key' in the database to null. A null validation_key indicates a validated upload and you can allow downloads of that file.
0
0
0
0
2012-10-08T18:23:00.000
2
0
false
12,787,317
0
0
1
1
web2py experts. The task I'm trying to accomplish is the following: -permit a person browsing my site to upload a file to my site through a form (implemented through crud.create()) -the visitor is not required to establish an account or log in to upload a file -the user is required to provide an email address in order for the file to be uploaded -basically, after the user uploads a file, the file is held in escrow/limbo, and a validation/verification email is sent to the user -once the user clicks on the link in the validation email, the file is posted to the page, and is made publicly available for download What's the best way to go about doing this? Thanks!
Reportlab: How to add uncertain contents using BaseDocTemplate?
13,022,662
1
0
384
0
python,pdf,reportlab
If you use Platypus with ReportLab you can get a table of contents "for free": just see the ReportLab manual for details but you basically just add a TableOfContents to the list of Flowables for the document and you're done. Otherwise you'll have to figure out all the logic for building a table of contents yourself.
0
0
0
0
2012-10-09T01:42:00.000
1
1.2
true
12,791,769
0
0
1
1
I want to add contents on first page. But the data is uncertain, contents must draw depend on the data. I try to fix this problem by drawing twice, calculating and recording the contents, and it works well. But it wastes time and ungainly. Can I insert first page after completing drawing? Or other ways to fix this problem? Sorry, I'm poor of English..
For what purpose Django is used for?
12,798,019
48
64
66,634
0
python,django
No. It's not for making websites. Your sample just sounds like you want plain old HTML. Django is for creating web applications. That is, software, normally backed by a database, that includes some kind of interactivity, that operates through a browser. A Framework provides a structure and common methods for making this kind of software.
0
0
0
0
2012-10-09T10:26:00.000
3
1.2
true
12,797,999
0
0
1
1
I heard a lot of people talking about Django on various forums. But I am having a very basic question : What is meant by Framework and why Django is used. After listening a lot about Django, I ran few chapters for Django (from Djangobook.com). After running these chapters, I am wondering how Django can be used to create a very simple website. (Website should have few pages like Home, Favorites, About, Contact linked to each other and will be providing static content). Can Django be used for creation of such website? I searched a lot on internet but couldn't find any relevant examples, I only encountered with the examples for creation of blog, forum sites etc. If Django can be used for creation of this website, what should be the approach. Can someone please explain this basic term "Framework" and its significance?
How to fetch user's mobile number from facebook?
12,824,092
4
4
2,059
0
python,django,facebook,facebook-graph-api,django-socialauth
The API does not let you access the user's contact number. You will have to request the user's contact details manually using a form.
0
0
0
0
2012-10-09T12:12:00.000
1
1.2
true
12,799,772
0
0
1
1
I am using django-social_auth to make users register and login via facebook. I want to access the phone number of the user. Tried searching on google and stackoverflow , but didn't find any answer. Searched the facebook docs as well. There I found that there used to be permission for 'user_mobile_phone' but it has been removed. It was also written than now it will be provided with basic permissions but it wasn't available(what I found). I tried using Graph API, but was unsuccessful. So, Someone please tell me the way ,if there is any, to get user data. EDIT:17 June 2014 - Is this possible now to get User's Mobile number via the Graph API ?
Leanest way to prevent scripted abuse of a web app?
12,806,423
2
4
1,007
0
python,security,flask,spam-prevention
You should sit down and decide what exactly your "core" problems in the scenario of your app are, and who your likely users will be. That will help you guide the right solution. In my experience, there are a lot of different problems and solutions in this subject - and none are a "one size fits all" If you have a problem with Anonymous users , you can try to migrate as much of the functionality behind an 'account wall' as possible. If you can't use an account wall, then you'll be better off with some IP based tracking, along with some other headers/javascript stuff. Going by IP alone can be a disaster because of corporate proxies , home routers, etc. You'll run the risk of too many false positives. If you add in browser info, unsavory users can still fake it - but you'll penalize fewer real users. You might want an account wall to only serve as a way to enforce a cookie , or it might plug into the idea of having a site identity where experience earns privilege You might want an account that can map to another trusted site's account. For example, I generally trust a 3rd party account binding against Facebook - who are pretty decent at dealing with fake accounts. I don't trust a 3rd party account binding against Twitter - which is largely spam. You might only require site "registration" to need solving a captcha , or something else mildly inconvenient to weed out most unsavory visits. If the reward for bad behavior is high enough though, you won't solve anything. I could talk about this all day. From my perspective, you have to solve the business logic and ux concepts first - and then a tech solution is much easier.
0
0
0
1
2012-10-09T17:59:00.000
3
0.132549
false
12,805,732
0
0
1
3
I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly. I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the script could be set up to delay that long. I also thought to grab the IP and if too many requests from it are made in x amount of time, deny anymore for so long, but this would require something like redis to run efficiently, which I'd like to avoid having to pay for. I prefer a cookie-based solution unless something like redis can prove it's worth. What are the 'industry standards' for dealing with these kinds of situations? What methods come with the least amount of cost/performance trade-offs?
Leanest way to prevent scripted abuse of a web app?
14,003,551
0
4
1,007
0
python,security,flask,spam-prevention
An extremely simple method that I have used before is to have an additional input in the registration form that is hidden using CSS (i.e. has display:none). Most form bots will fill this field in whereas humans will not (because it is not visible). In your server-side code you can then just reject any POST with the input populated.
0
0
0
1
2012-10-09T17:59:00.000
3
0
false
12,805,732
0
0
1
3
I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly. I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the script could be set up to delay that long. I also thought to grab the IP and if too many requests from it are made in x amount of time, deny anymore for so long, but this would require something like redis to run efficiently, which I'd like to avoid having to pay for. I prefer a cookie-based solution unless something like redis can prove it's worth. What are the 'industry standards' for dealing with these kinds of situations? What methods come with the least amount of cost/performance trade-offs?
Leanest way to prevent scripted abuse of a web app?
12,806,126
4
4
1,007
0
python,security,flask,spam-prevention
There is no way to achieve this with cookies, since a malicious script can just silently drop your cookie. Since you have to support the case where a user first visits (meaning without any cookies set), there is no way to distinguish between a genuine new user and a malicious script by only considering state stored on the client. You will need to keep track of your users on the server-side to achieve your goals. This can be as simple as an IP-based filter that prevents fast posting by the same IP.
0
0
0
1
2012-10-09T17:59:00.000
3
0.26052
false
12,805,732
0
0
1
3
I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly. I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the script could be set up to delay that long. I also thought to grab the IP and if too many requests from it are made in x amount of time, deny anymore for so long, but this would require something like redis to run efficiently, which I'd like to avoid having to pay for. I prefer a cookie-based solution unless something like redis can prove it's worth. What are the 'industry standards' for dealing with these kinds of situations? What methods come with the least amount of cost/performance trade-offs?
Bitnami - /opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5
12,898,508
7
4
1,566
0
python,django,centos,bitnami
Can you execute the following and see if it solves your issue? . /opt/bitnami/scripts/setenv.sh (notice the space between the dot and the path to the script) Also what are you executing that gives you that error?
0
1
0
1
2012-10-10T08:20:00.000
1
1
false
12,814,973
0
0
1
1
I getting the below issue when firing up django or ipython notebook /opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5 However libreadline.so.5 exists in my system after locating it as shown below root@linux:/opt/bitnami/scripts# locate libreadline.so.5 /opt/bitnami/common/lib/libreadline.so.5 /opt/bitnami/common/lib/libreadline.so.5.2 I have also exported the path in the environment variable (where the libreadlive.so.5 is located) but still does'nt seems to be resolving my issue (see below) export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$HOME/opt/bitnami/common/lib Also there is a script which is being provided by bitnami which is located in /opt/bitnami/scripts/setenv.sh. But even after executing it still i am stuck. Anyone can help me with this
Django fixture in csv
12,827,105
7
4
2,175
0
python,django,csv,fixture
Django's built-in fixtures functionality doesn't support CSV. You'd need to process the file automatically using the csv module, probably in the test's setUp method.
0
0
0
0
2012-10-10T19:21:00.000
2
1.2
true
12,826,756
0
0
1
1
For a Django test I'd like to load a fixture, which is in a csv file. What is the best way to do that?
How to use a python script on a django website
12,840,259
0
0
1,101
0
python,django,webpage
In your view, you can get the form data using request object. You can pass the form values to your script and send output to your response object. It seems you didn't completely understand how django works. Please go through the tutorial again.
0
0
0
0
2012-10-11T12:26:00.000
2
0
false
12,839,509
0
0
1
1
Am new to Django but want to learn it and have covered pretty much the basics on the Django website. Here is my problem: I have written a python script which presently works in the python shell, but I want to make use of the script on my web. So that when a user goes to my website and provides the neccesary input, clicks submit, the webpage links the input to the python script(which already has input fields like those on the webpage), and the python script runs according to the input given by the user, evaluates it and prints the result of the script on the webpage. Please help me out guys, counting on you all. But feel free to suggest other frameworks that could best serve my problem.
Exclude files from causing GAE server restart
12,847,050
0
0
94
0
python,google-app-engine,go
If you change the files that comprise your application, the application will need to restart in order to serve the new files. If this is a real sticking point for you, I would suggest hosting the files elsewhere, like a CDN. Your application and the static resources that it employs do not need to be all in the same place.
0
1
0
0
2012-10-11T17:40:00.000
1
1.2
true
12,845,400
0
0
1
1
Is there a way to avoid GAE server restart when the file within the root of my application changes. I use Go (GAE server is python based) runtime. The intention is not to reload the server when some of my files (html, css, js files; which are under /static folder) changes. This is to avoid startup time during development. Any way to exclude them from file watch. thanks.
What Python Framework/database should I use for my webapp
12,849,885
0
0
457
0
javascript,python,database,web-applications,web-frameworks
There are many, many, many ways to do what you seem to want to do. I've been working on a home project that uses tornado.web (easy REST api), mongodb (storage, works espectially well with JSON documents), and nginx (load balancing for surges in requests). For the front-end, I'm using nginx to serve static web content... which is comprised of a Backbone.js application for various CRUD operations. But that's just how I did it.
0
0
0
0
2012-10-11T22:58:00.000
3
0
false
12,849,846
0
0
1
1
I am working on building a webapp. I have been learning Python on my own for a few months but I need help figuring out HOW to proceed with building the app, specifically which web framework/database to use. As I'm fairly new to this, I may not be using the correct terms, and I'm sure many of these things may be obvious, but this is a basic list of what I need the framework to be able to do: I need to have a database, I'm not sure how large, the data is coming from an API that API returns JSON which I parse in python using Simple JSON, so I think it's just string dictionaries. For the API data I'd prefer to have one large database with with every key/value from the dictionary being a column/value in the database, as this seems like it would be the easiest to query - please let me know if this is an incorrect assumption. In the front end of the webapp, which I've been told will need to be written in Javascript, users will query the datastore using various different parameters (e.g.show me the last 10 posts from blogs X,Y, and Z, show me topics that were posted to by blog A and blog B.) The framework should track user activity and save the data to use it for future recommendations. Multiple users will be making queries at the same time, and the framework should be saving their activity while returning the data they requested. The webapp should be scalable, so it can handle the requests in the event that the app gets a surge in traffic/users etc. for any reason. This is currently a small project but in the case that more people want to use it I'd like to have that be an option without having to re-program it from scratch. Lastly, as I'm fairly new to programming, all things equal, or nearly equal I would much prefer a framework that is easy to use.
PostgreSQL for Django on Elastic Beanstalk
21,391,684
5
5
2,422
1
python,django,postgresql,amazon-elastic-beanstalk
Postgre is now selectable from the AWS RDS configurations. Validated through Elastic Beanstalk application setup 2014-01-27.
0
0
0
0
2012-10-12T00:21:00.000
2
0.462117
false
12,850,550
0
0
1
1
I'm reading conflicting reports about using PostgreSQL on Amazon's Elastic Beanstalk for python (Django). Some sources say it isn't possible: (http://www.forbes.com/sites/netapp/2012/08/20/amazon-cloud-elastic-beanstalk-paas-python/). I've been through a dummy app setup, and it does seem that MySQL is the only option (amongst other ones that aren't Postgres). However, I've found fragments around the place mentioning that it is possible - even if they're very light on detail. I need to know the following: Is it possible to run a PostgreSQL database with a Django app on Elastic Beanstalk? If it's possible, is it worth the trouble? If it's possible, how would you set it up?
Ultrasonic thread that runs in the background in python
12,852,400
2
0
235
0
python,multithreading,nxt-python
You used the daemon thread instead of normal thread. because this is different to normal thread. I hope so daemon thread resolve your problem.
0
0
0
1
2012-10-12T02:26:00.000
1
1.2
true
12,851,374
1
0
1
1
How do I create a thread that continuously checks for obstacles using the ultrasonic class in nxt-python 2.2.2? I want to implement it in a way that while my robot is moving it also detects obstacles in a background process and once it detects an object it will brake and do something else
Tastypie documentation generation
12,867,026
0
14
2,869
0
django,python-sphinx,tastypie,documentation-generation
Perhaps I'm completely missing the point of your question but if you are just trying to build the docs that come with the source distribution there is a Makefile in the docs directory that performs the necessary actions. You are required to specify a target output type such as html, json, latex, etc. I keep a local copy of the docs for django, tastypie, and slumber as I use all three in conjunction with each other and I use the option make html frequently. If I am mistaken about what you are trying to accomplish perhaps we can come to some clarification.
0
0
0
1
2012-10-12T03:43:00.000
3
0
false
12,851,898
0
0
1
1
I'm trying to use auto-doc tool to generate API doc for Tastypie REST API. I tried Tastytool, but it seems not showing the API's result parameters but the model's columns. Then I tried Sphinx seems more promising since Tastypie supports Sphinx, but I can't find an example to show where & how to put comment for the API inside the code, and generate them into the document. Anyone can share some info or example about correctly write comment and generate Sphinx doc for Tastypie based API? thanks.
Generating a url with the same GET parameters as the current page in a Django template
12,864,644
3
10
1,843
0
python,django
you could pass request.META['QUERY_STRING'] to the template. You can grab the get params before you render the template and pass them to the template and render them on the correct link. You could also build a query string from request.GET
0
0
0
0
2012-10-12T17:58:00.000
3
0.197375
false
12,864,616
0
0
1
1
I have a certain link to a url in a Django template. I would like to grab all the GET parameters of the current page url and add them to the url of the template's link. The current page might have zero GET parameters.