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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Are "Field" and "Fields" reserved words in Django or Python? | 24,553,843 | 2 | 3 | 1,219 | 0 | python,django | little explanation with fun
Answer is Simply No,
Because Language only has the authority to own anything.Python is the owner of the house
The Django guy is paying rent to Python guy. So, How Django guy can reserve the objects of the house?
same logic is applied here too | 0 | 0 | 0 | 0 | 2014-07-02T16:19:00.000 | 2 | 0.197375 | false | 24,536,240 | 0 | 0 | 1 | 1 | I'm developing a django project for agriculture. I want to name an app "fields" and inside the app "fields" I want to name a model "Field" (referring to a farmer field).
I tried it and it works, so I assume that "fields" and "Field" are not reserved words in Django or Python. But I was just wondering if using these wo... |
integrating with existing html page django-page-cms | 24,554,222 | 0 | 0 | 64 | 0 | python,django | First you need to create page in admin console. Then add the placeholder in your template
like what tutorial saying
{% get_page "news" as news_page %}
{% for new in news_page.get_children %}
<li>
{{ new.publication_date }}
{% show_content new body %}
{% endfor %} | 0 | 0 | 0 | 0 | 2014-07-03T11:51:00.000 | 1 | 1.2 | true | 24,552,964 | 0 | 0 | 1 | 1 | I have installed django-page-cms successfully i think. Like other cms, it is also for creating new pages. But I already have html pages in my project. How to integrate with that?
They want me to put place holder in html page, like:
{% load pages_tags %}
but I think this will bring the content from the already create... |
Difficulty accessing local webserver | 24,558,290 | 0 | 1 | 184 | 0 | android,python,solr,webserver,tokyo-tyrant | Both "localhost" and "127.0.0.1" are local loopback interfaces only: they only make sense within the same machine. From your Android device, assuming it's on the same wifi network as your machine, you'll need to use the actual IP address of your main machine: you can either find that from the network settings of that m... | 0 | 1 | 1 | 0 | 2014-07-03T15:25:00.000 | 4 | 0 | false | 24,557,707 | 0 | 0 | 1 | 3 | I have an Echoprint local webserver (uses tokyotyrant, python, solr) set up on a Linux virtual machine.
I can access it through the browser or curl in the virtual machine using http//localhost:8080 and in the non-virtual machine (couldn't find out how to say it better) I use the IP on the virtual machine also with the ... |
Difficulty accessing local webserver | 24,635,024 | 0 | 1 | 184 | 0 | android,python,solr,webserver,tokyo-tyrant | In case someone has the same problem, I solved it.
The connection has to be by cable and on the VMware Player settings the network connection has to be bridged, also you must click "Configure adapters" and uncheck the "VirtualBox Host-Only Ethernet Adapter". | 0 | 1 | 1 | 0 | 2014-07-03T15:25:00.000 | 4 | 1.2 | true | 24,557,707 | 0 | 0 | 1 | 3 | I have an Echoprint local webserver (uses tokyotyrant, python, solr) set up on a Linux virtual machine.
I can access it through the browser or curl in the virtual machine using http//localhost:8080 and in the non-virtual machine (couldn't find out how to say it better) I use the IP on the virtual machine also with the ... |
Difficulty accessing local webserver | 24,557,803 | 0 | 1 | 184 | 0 | android,python,solr,webserver,tokyo-tyrant | Is the server bound to localhost or 0.0.0.0?
Maybe your host resolves that ip to some kind of a localhost as well, due to bridging. | 0 | 1 | 1 | 0 | 2014-07-03T15:25:00.000 | 4 | 0 | false | 24,557,707 | 0 | 0 | 1 | 3 | I have an Echoprint local webserver (uses tokyotyrant, python, solr) set up on a Linux virtual machine.
I can access it through the browser or curl in the virtual machine using http//localhost:8080 and in the non-virtual machine (couldn't find out how to say it better) I use the IP on the virtual machine also with the ... |
Projection of a Tastypie REST API into python objects | 24,677,758 | 0 | 2 | 276 | 0 | python,mysql,django,rest,sqlalchemy | You want to see what queries are generated by django ORM or tastepy?
I think one easy way is to do a wrappper arround the DB class, where you run the DB class method, analise the results and print our save them to a file.
Another way to do this, is to use mysql slow_query_log with 0 seconds to log all the queries that... | 0 | 0 | 0 | 1 | 2014-07-03T19:40:00.000 | 2 | 0 | false | 24,562,068 | 0 | 0 | 1 | 1 | I want to test web applications that were developed using Django framework and Tastypie.
My plan was to test the REST API calls of the web apps against the queries they perform on the MySql DB. In order to do so I've investigated a little bit about DB access framework, and have encountered SQLalchemy framework, and the... |
Django Models Abstract Base Class - can they be extended across apps? | 24,563,099 | 1 | 1 | 123 | 0 | python,django,abstract-class | Since an abstract base class is not a registered model, it makes absolutely no difference where it lives. It can be in any Python file that can be imported by the models.py files in each app. | 0 | 0 | 0 | 0 | 2014-07-03T20:40:00.000 | 1 | 1.2 | true | 24,562,961 | 0 | 0 | 1 | 1 | Sorry for the silly question, I can't seem to find a definitive answer.
In almost all of the models in all of the apps in my Django project, there are two common fields - last_updated and date_created. I want to cut down on code by putting them into an abstract base class, of which all of my models extend.
Is there som... |
BeautifulSoup Object Will Not Pickle, Causes Interpreter to Silently Crash | 24,563,375 | 1 | 9 | 3,438 | 0 | python,beautifulsoup,pickle | In fact, as suggested by dekomote, you have only to take advantadge that you can allways convert a soup to an unicode string and then back again the unicode string to a soup.
So IMHO you should not try to pass soup object through the multiprocessing package, but simply the strings representing the soups. | 0 | 0 | 0 | 0 | 2014-07-03T20:53:00.000 | 3 | 0.066568 | false | 24,563,148 | 1 | 0 | 1 | 1 | I have a soup from BeautifulSoup that I cannot pickle. When I try to pickle the object the python interpreter silently crashes (such that it cannot be handled as an exception). I have to be able to pickle the object in order to return the object using the multiprocessing package (which pickles objects to pass them betw... |
Is Beautiful Soup available for Python 3.4.1? | 27,249,435 | 0 | 12 | 11,995 | 0 | python,beautifulsoup | I'm new to this as well.
I agree - it's not always clear from forum answers where to type the various suggestions when you're new to the subject.
Start by opening a command prompt. You can do this by typing CMD into the searchbox after pressing the start button.
At the command prompt, type "python -m pip install beauti... | 0 | 0 | 0 | 0 | 2014-07-06T01:50:00.000 | 4 | 0 | false | 24,592,036 | 0 | 0 | 1 | 3 | I want to try and make a program that downloads images from the internet, and I have found a guide that uses Beautiful soup. I have heard of Beautiful Soup before, so I figured that I would try it out. My only issue is that I can't seem to find a version for Python 3. I went to their website, but I was unable to find a... |
Is Beautiful Soup available for Python 3.4.1? | 37,222,073 | 0 | 12 | 11,995 | 0 | python,beautifulsoup | Try using "python -m pip install beautifulsoup4"
This line is working perfectly fine for me on Python 3.4 | 0 | 0 | 0 | 0 | 2014-07-06T01:50:00.000 | 4 | 0 | false | 24,592,036 | 0 | 0 | 1 | 3 | I want to try and make a program that downloads images from the internet, and I have found a guide that uses Beautiful soup. I have heard of Beautiful Soup before, so I figured that I would try it out. My only issue is that I can't seem to find a version for Python 3. I went to their website, but I was unable to find a... |
Is Beautiful Soup available for Python 3.4.1? | 37,579,583 | 0 | 12 | 11,995 | 0 | python,beautifulsoup | Below work for me.
Source of content is quora.com.
Make sure you download the recent beautifulsoup version.
For Windows how to install beautifulsoup4 for python2 or python3.
Place the file you downloaded in any file directory on your computer.
First locate where your Python file directory is below am using C:\Python27
... | 0 | 0 | 0 | 0 | 2014-07-06T01:50:00.000 | 4 | 0 | false | 24,592,036 | 0 | 0 | 1 | 3 | I want to try and make a program that downloads images from the internet, and I have found a guide that uses Beautiful soup. I have heard of Beautiful Soup before, so I figured that I would try it out. My only issue is that I can't seem to find a version for Python 3. I went to their website, but I was unable to find a... |
Is it possible to add a letter or some other character in front of an incrementing field? | 24,602,097 | 0 | 0 | 113 | 0 | python,mysql,django,django-models | It is not possible with an auto-incrementing field, exclusively. You could set up another column inside each table with a single letter identifying the table, have an auto-incrementing column, and then make the key the combination of the two. You can also set this up using a trigger.
However, this doesn't fully make ... | 0 | 0 | 0 | 0 | 2014-07-07T01:43:00.000 | 2 | 0 | false | 24,602,022 | 0 | 0 | 1 | 1 | What I would like to do is have my primary key field (or another field as long as it accepts auto incrementing) auto increment with a letter in front of it. For example:
I would like to be able to make pk equal A1,A2,A3 in one table, and if i choose, B1, B2,B3 in another table. Is this possible with django? mysql? The ... |
Execute Python Script from Django | 24,620,400 | 0 | 0 | 292 | 0 | python,django,subprocess,popen,django-celery | I suggest using Celery.
subprocess, multiprocessing, and threading all are powerful tools, but are in general hard to get working. They're more useful if you already have a working system, are running at the limit of the hardware, and don't mind spending a good deal of effort to get lower latency or parallel processin... | 0 | 1 | 0 | 0 | 2014-07-07T21:31:00.000 | 1 | 1.2 | true | 24,620,225 | 0 | 0 | 1 | 1 | I am trying to execute a python script from a webpage through a Django view. Other questions related to a known script from within the Django project directory. I need to be able to execute a script anywhere on the system given the file path. Eventually, multiple scripts will be run in parallel using Celery or a simila... |
Django - Multiple apps on one webpage? | 24,644,610 | 11 | 15 | 11,743 | 0 | python,django | A django app doesn't really map to a page, rather, it maps to a function. Apps would be for things like a "polls" app or a "news" app. Each app should have one main model with maybe a couple supporting ones. Like a news app could have a model for articles, with supporting models like authors and media.
If you wanted... | 0 | 0 | 0 | 0 | 2014-07-08T02:16:00.000 | 5 | 1 | false | 24,622,714 | 0 | 0 | 1 | 1 | I've looked all over the net and found no answer.
I'm new to Django. I've done the official tutorial and read many more but unfortunately all of them focus on creating only one application. Since it's not common to have a page as a single app, I would like to ask some Django guru to explain how I can have multiple apps... |
Django include models.py from project to multiple apps | 24,628,844 | 0 | 2 | 2,218 | 0 | python,django,django-models,import | You are not meant to put models directly on a project level in Django. Every model have to be associated with a particular app. On the other hand you can import models between apps.
If you feel a need for a project level models it just means you haven't partitioned your functionality into apps properly. There shouldn't... | 0 | 0 | 0 | 0 | 2014-07-08T09:10:00.000 | 3 | 0 | false | 24,627,919 | 0 | 0 | 1 | 1 | I would like to know if there is a way to include/import the models.py from the project directory to multiple apps without copying the model in each app. Thank you! |
Gunicorn max_requests for Production | 24,656,069 | 0 | 8 | 3,830 | 0 | python,gunicorn | Yes and no. Depends. Restarting workers eats resources. But the price is not too high. On the other hand if you have memory leaks then it will allow you to save memory. Thus effectively increasing performance. | 0 | 0 | 0 | 0 | 2014-07-09T13:58:00.000 | 2 | 0 | false | 24,655,713 | 0 | 0 | 1 | 2 | Is there any effect on performance if I use gunicorn max_requests setting for production server? |
Gunicorn max_requests for Production | 26,990,224 | 0 | 8 | 3,830 | 0 | python,gunicorn | I've just found that this setting is the cause of a response time issue I have having. Baseline response time of one of my sites, measured locally, was about 20ms. This goes up to about 300ms on a worker restart, so yes, there is a performance impact.
As a result of this, I've upped my setting from a super-safe 10 to 1... | 0 | 0 | 0 | 0 | 2014-07-09T13:58:00.000 | 2 | 0 | false | 24,655,713 | 0 | 0 | 1 | 2 | Is there any effect on performance if I use gunicorn max_requests setting for production server? |
Using PhoneGap + Google App Engine to Upload and Save Images | 24,657,475 | 0 | 1 | 620 | 1 | python,google-app-engine,cordova,google-cloud-storage | Yes, that is a fine use for GAE and GCS. You do not need an <input type=file>, per se. You can just set up POST parameters in your call to your GAE url. Make sure you send a hidden key as well, and work from SSL-secured urls, to prevent spammers from posting to your app. | 0 | 1 | 0 | 0 | 2014-07-09T14:05:00.000 | 2 | 0 | false | 24,655,877 | 0 | 0 | 1 | 1 | Goal: Take/attach pictures in a PhoneGap application and send a public URL for each picture to a Google Cloud SQL database.
Question 1: Is there a way to create a Google Cloud Storage object from a base64 encoded image (in Python), then upload that object to a bucket and return a public link?
I'm looking to use PhoneGa... |
Set environment variables in GAE control panel | 35,254,560 | 4 | 2 | 2,796 | 0 | python,google-app-engine | You can store your keys in datastore. Later when you need them in the code, you can fetch them from datastore and cache them by memcache. | 0 | 1 | 0 | 0 | 2014-07-10T10:06:00.000 | 3 | 0.26052 | false | 24,673,772 | 0 | 0 | 1 | 1 | I deploy my project to GAE over Github. There is some foreign API-key which I don't want to save in repository and make them public. Is it possible to set an environment variable for a project in GAE control panel so I can catch it in my application? |
Python Export Program to PDF using Latex format | 24,684,691 | 1 | 0 | 2,206 | 0 | python,pdf,export,latex,pdflatex | generate a Latex file.tex with a Python script
f= open("file.tex", 'w')
f.write('\documentclass[12pt]{article}\n')
f.write('\usepackage{multicol}\n')
f.write('\n\begin{document}\n\n')
...
f.write('\end{document}')
f.close()
run pdflatex on the LaTex file from the Python script as a subprocess
subprocess.call('latex fi... | 0 | 0 | 0 | 1 | 2014-07-10T19:00:00.000 | 3 | 0.066568 | false | 24,684,316 | 0 | 0 | 1 | 1 | I have a GUI program in Python which calculates graphs of certain functions. These functions are mathematical like say, cos(theta) etc. At present I save the graphs of these functions and compile them to PDF in Latex and write down the equation manually in Latex.
But now I wish to simplify this process by creating a t... |
Django Rest Framework--deny access to list but not to retrieve | 27,932,256 | 0 | 1 | 302 | 0 | python,django,rest,permissions,django-rest-framework | One of the arguments to has_permission is view, which has an attribute .action, which is one of the five "LCRUD" actions ("list"/"create"/"retrieve"/"update"/"destroy"). So I think you could use that to check, in has_permission, whether the action being performed is a list or a retrieve, and deny or allow it according... | 0 | 0 | 0 | 0 | 2014-07-10T19:32:00.000 | 1 | 0 | false | 24,684,821 | 0 | 0 | 1 | 1 | I'm using Django Rest Framework and I'm having some trouble with permissions. I know how to use has_permission and has_object_permission, but I have a number of cases where someone needs to be able to access retrieve but not list--e.g., a user has access to their own profile, but not to the full list of them. The pro... |
How can I identify requests made via AJAX in Python's Flask? | 56,367,083 | 1 | 15 | 5,005 | 0 | python,ajax,angularjs,flask | There isn't any way to be certain whether a request is made by ajax.
What I found that worked for me, was to simply include a get parameter for xhr requests and simply omit the parameter on non-xhr requests.
For example:
XHR Request: example.com/search?q=Boots&api=1
Other Requests: example.com/search?q=Boots | 0 | 0 | 1 | 0 | 2014-07-10T23:06:00.000 | 3 | 0.066568 | false | 24,687,736 | 0 | 0 | 1 | 1 | I'd like to detect if the browser made a request via AJAX (AngularJS) so that I can return a JSON array, or if I have to render the template. How can I do this? |
Django: storing/querying a dictionary-like data set? | 24,690,665 | 0 | 0 | 992 | 1 | python,mysql,django,mongodb,database | In a Django project you've got 4 alternatives for this kind of problem, in no particular order:
using PostgreSQL, you can use the hstore field type, that's basically a pickled python dictionary. It's not very helpful in terms of querying it, but does its job saving your data.
using Django-NoRel with mongodb you get th... | 0 | 0 | 0 | 0 | 2014-07-11T00:29:00.000 | 2 | 0 | false | 24,688,388 | 0 | 0 | 1 | 1 | I apologize if this has been asked already, or if this is answered somewhere else.
Anyways, I'm working on a project that, in short, stores image metadata and then allows the user to search said metadata (which resembles a long list of key-value pairs). This wouldn't be too big of an issue if the metadata was standard... |
Add a column to heroku postgres database | 24,698,874 | 0 | 1 | 1,178 | 1 | python,django,postgresql,heroku | I presume that you have created a migration to add mainsite_message.spam to the schema. Have you made sure that this migration is in your git repository?
If you type git status you should see untracked files. If the migration is untracked you need to git add path_to_migration and then push it to Heroku before you can r... | 0 | 0 | 0 | 0 | 2014-07-11T12:11:00.000 | 3 | 0 | false | 24,697,420 | 0 | 0 | 1 | 2 | So, locally I've changed my models a few times and used South to get everything working. I have a postgres database to power my live site, and one model keeps triggering a column mainsite_message.spam does not exist error. But when I run heroku run python manage.py migrate mainsite from the terminal, I get Nothing to... |
Add a column to heroku postgres database | 24,697,852 | 0 | 1 | 1,178 | 1 | python,django,postgresql,heroku | Did you run schemamigration before? If yes, go to your database and take a look at your table "south_migrationhistory" there you can see what happened.
If you already did the steps above you should try to open your migration file and take a look as well, there you can find if the creation column is specified or not! | 0 | 0 | 0 | 0 | 2014-07-11T12:11:00.000 | 3 | 0 | false | 24,697,420 | 0 | 0 | 1 | 2 | So, locally I've changed my models a few times and used South to get everything working. I have a postgres database to power my live site, and one model keeps triggering a column mainsite_message.spam does not exist error. But when I run heroku run python manage.py migrate mainsite from the terminal, I get Nothing to... |
How to throttle S3 & Glacier upload/download speeds with boto? | 41,159,662 | 1 | 0 | 1,618 | 0 | python,boto | The simplest would be to use traffic shaping tools under linux, like tc. These tools let you control bandwidth and even simulate network packet loss or even long distance communication issues. Easy to write a python script to control the port behavior via a shell. | 0 | 0 | 1 | 0 | 2014-07-11T16:53:00.000 | 3 | 0.066568 | false | 24,702,818 | 0 | 0 | 1 | 1 | I'm using boto to upload and download files to S3 & Glacier.
How can I ratelimit/throttle the uploading and downloading speeds? |
Is there a way to specify a default base-template for all templates in django? | 24,710,778 | 1 | 1 | 273 | 0 | python,django,django-templates | Unless you want to write your own template loader function that looks to your settings for the default and monkey-patch it in, then "no, there isn't a way to do that" is accurate.
At least it's only one line per file.
Plus, being a long-standing Django convention, other devs will immediately be able to see which base... | 0 | 0 | 0 | 0 | 2014-07-12T04:08:00.000 | 3 | 1.2 | true | 24,709,551 | 0 | 0 | 1 | 2 | I'm 2 hours into Django and am wondering if there is a way to specify a default base template that will automatically be loaded for all templates so that you don't have to repeat yourself and specify {% extends "foo.html" %} at the top of every page template.
For example, at the project or app level some metadata(setti... |
Is there a way to specify a default base-template for all templates in django? | 24,711,278 | 1 | 1 | 273 | 0 | python,django,django-templates | Don't forget, it's a guiding principle in Python - and therefore also in Django - that explicit is better than implicit. So whereas Rails, for example, emphasises convention over configuration and has all sorts of things happen automatically, this is very much alien to the Python way of doing things.
So no, there is no... | 0 | 0 | 0 | 0 | 2014-07-12T04:08:00.000 | 3 | 0.066568 | false | 24,709,551 | 0 | 0 | 1 | 2 | I'm 2 hours into Django and am wondering if there is a way to specify a default base template that will automatically be loaded for all templates so that you don't have to repeat yourself and specify {% extends "foo.html" %} at the top of every page template.
For example, at the project or app level some metadata(setti... |
Using Django Users for all logged in users, and registering them | 24,718,066 | 0 | 0 | 48 | 0 | python,django,django-users,python-3.4 | I was just talking to an advanced developer friend of mine about this. He said using djangos users is frowned upon and to build it out separately. I don't know much more on this but it's something I will be doing in the future. | 0 | 0 | 0 | 0 | 2014-07-12T21:04:00.000 | 2 | 0 | false | 24,717,307 | 0 | 0 | 1 | 1 | I have a site that - other than the signup process - will be only used by logged in users. It's my first Django site, and I'm wondering whether I can use the Django user model (slightly extended) to work with all my users, or should it only be used for administrative users such as myself?
Apologies if this is a stupid ... |
How do I test that Django upgrades don't break the current database? | 24,718,048 | 0 | 0 | 50 | 0 | python,django,upgrade | You can always crate a dump of your database if you are afraid of losing data. | 0 | 0 | 0 | 0 | 2014-07-12T22:39:00.000 | 2 | 0 | false | 24,717,941 | 0 | 0 | 1 | 2 | What is the best way of writing a unit test in Django that tests the validity of current database information when Django is upgraded?
My unit tests create new information in the databases when they are run, but this isn't helpful for safely upgrading. |
How do I test that Django upgrades don't break the current database? | 24,731,271 | 0 | 0 | 50 | 0 | python,django,upgrade | What do you think could happen when you upgrade Django? Django updated your files not your database without permission from you. So you could upgrade your Django and run all your tests (local) to see if nothing is broken. | 0 | 0 | 0 | 0 | 2014-07-12T22:39:00.000 | 2 | 0 | false | 24,717,941 | 0 | 0 | 1 | 2 | What is the best way of writing a unit test in Django that tests the validity of current database information when Django is upgraded?
My unit tests create new information in the databases when they are run, but this isn't helpful for safely upgrading. |
pygtk TextView and WebKit.WebView synchronized scrolling | 24,722,441 | 0 | 0 | 221 | 0 | python,webkit,gtk,pygtk | why do you want sync those scrollbars? You can achieve this by using the same Gtk.Adjustment (number of pages sets to 0).
I haven't use much of webkit but it essentialy a widget. so maybe a workaround would be disconnect a signal "value-changed" from Gtk.Adjustment until "load-status" signal from WebKitView reached We... | 1 | 0 | 0 | 0 | 2014-07-12T23:15:00.000 | 1 | 0 | false | 24,718,142 | 0 | 0 | 1 | 1 | I've got a text view and a web view, each inside a scrolled window of their own and I'm trying to achieve synchronized scrolling between the two but I can't seem to get it to work.
The web view is basically taking the text from the text view and rendering it as marked up HTML via webview.load_html_string(). I think the... |
Django: Put a Form into a Form (recursive ...) | 25,321,619 | 0 | 2 | 564 | 0 | python,django,forms,recursion,django-forms | In first glance, your idea seems to be complex. And the immediate question is - "Why do need such feature?". 99% - of tasks can be solved with built-in Django "bricks", another 1% - "Please hardcode". Also I may assume that the problem behind such an idea is complex too, and will be hard understandable by end user. | 0 | 0 | 0 | 0 | 2014-07-13T11:16:00.000 | 4 | 0 | false | 24,722,087 | 0 | 0 | 1 | 2 | I like Django forms library, but it would be even better if a form could contain forms.
My dream looks like this:
I have a form which behaves like normal form: for example a class called SuperForm
SuperForm can contain several normal forms, or even (recursive) SuperForms
You can bind it to data (to make it bound), ca... |
Django: Put a Form into a Form (recursive ...) | 25,411,066 | -1 | 2 | 564 | 0 | python,django,forms,recursion,django-forms | I think you are thinking about forms in a different way than what you should.
Forms are simply there for input. How they are processed is up to you.
Sure you can run is_valid on the form, and that would check against the modelform that you have assigned. The awesome thing is you can check multiple model forms on the ... | 0 | 0 | 0 | 0 | 2014-07-13T11:16:00.000 | 4 | -0.049958 | false | 24,722,087 | 0 | 0 | 1 | 2 | I like Django forms library, but it would be even better if a form could contain forms.
My dream looks like this:
I have a form which behaves like normal form: for example a class called SuperForm
SuperForm can contain several normal forms, or even (recursive) SuperForms
You can bind it to data (to make it bound), ca... |
could not save preference file google-apps-engine | 24,765,014 | 0 | 1 | 53 | 0 | python,google-app-engine | I think I have found the answer to my own question.
I have a small app I have written to backup my stuff to Google Drive, this app would appear to have an error in it that does not stop it from running but does cause it to make a file called
C:\Usera\myname\Google
Therefore GAE can not create a directory called C:\U... | 0 | 1 | 0 | 0 | 2014-07-14T04:13:00.000 | 1 | 0 | false | 24,729,427 | 0 | 0 | 1 | 1 | Just installed Google Apps Engine and am getting "could not save" errors.
Specifically if I go in to preferences I get
Could not save into preference file
C:\Usera\myname/Google\google_appengine_launcher.ini:No such file or directory.
So some how I have a weird path, would like to know where and how to change this. I ... |
Django: Finish processing one request from a user before proceeding to the next | 24,742,679 | 0 | 0 | 259 | 0 | python,django,rabbitmq,celery | I don't know why I didn't think of this sooner, I added in a unique_together clause which will prevent another like_object from being created. | 0 | 0 | 0 | 0 | 2014-07-14T16:54:00.000 | 2 | 0 | false | 24,741,712 | 0 | 0 | 1 | 1 | I'm currently looking for a solution that will prevent a user from making multiple requests at the same time. I would like the first request to finish before the I process the second request from the user. For example, lets say user adam liked and un-liked suzy's photo. Both unliking and liking of the photo happens in ... |
Do selenium tests in django applications increase coverage? | 24,768,403 | 2 | 0 | 826 | 0 | python,django,selenium,integration-testing,code-coverage | Well, they increase coverage if they execute code which is not executed by your other tests. However, that won't show up in your reports unless you figure out a way to capture which lines are executed during selenium testing, and add that into the data about coverage. | 0 | 0 | 1 | 0 | 2014-07-15T19:41:00.000 | 2 | 0.197375 | false | 24,766,819 | 0 | 0 | 1 | 1 | So, do they? That is the question. I'm not seeing any increase in my coverage reports with my integration tests done with selenium. |
How would I implement a change approval process for a Django model? | 24,767,411 | 0 | 0 | 2,143 | 0 | python,django | I would create another table (tablename_approval) with columns something like
approved | boolean
approved_by | foreign key to user
timestamp | timestamp
to track the state of each individual row.
You might want to consider an enum rather than boolean to track the difference between items which have not yet been a... | 0 | 0 | 0 | 0 | 2014-07-15T20:13:00.000 | 2 | 0 | false | 24,767,321 | 0 | 0 | 1 | 1 | I have a model for which changes need to be approved by a user with a certain flag before they are seen by everybody. Making two different identical models is not an option, because the model has a many-to-many field referencing itself, which needs to be linked to both approved and non-approved entries.
I'm using Djang... |
Uploading code to server and run automatically | 24,769,619 | 1 | 1 | 262 | 0 | python,cloud | Here are two approaches to this problem, both of which require shell access to the cloud server.
Write the program to handle the scheduling itself. For example, sleep and wake up every few miliseconds to perform the necessary checks. You would then transfer this file to the server using a tool like scp, login, and st... | 0 | 0 | 0 | 1 | 2014-07-15T23:02:00.000 | 2 | 0.099668 | false | 24,769,574 | 0 | 0 | 1 | 2 | I'm fairly competent with Python but I've never 'uploaded code' to a server before and have it run automatically.
I'm working on a project that would require some code to be running 24/7. At certain points of the day, if a criteria is met, a process is started. For example: a database may contain records of what time ... |
Uploading code to server and run automatically | 24,983,741 | 1 | 1 | 262 | 0 | python,cloud | Took a few days but I finally got a way to work this out. The most practical way to get this working is to use a VPS that runs the script. The confusing part of my code was that each user would activate the script at a different time for themselves. To do this, say at midnight, the VPS runs the python script (using sc... | 0 | 0 | 0 | 1 | 2014-07-15T23:02:00.000 | 2 | 0.099668 | false | 24,769,574 | 0 | 0 | 1 | 2 | I'm fairly competent with Python but I've never 'uploaded code' to a server before and have it run automatically.
I'm working on a project that would require some code to be running 24/7. At certain points of the day, if a criteria is met, a process is started. For example: a database may contain records of what time ... |
AWS ElasticBeanstalk "no files found to execute" | 24,920,993 | 0 | 0 | 74 | 0 | python,amazon-web-services,flask,amazon-elastic-beanstalk | An internal 500 error can be caused by many reasons. The "No files found to execute" issue seems interesting...Could you link to your log file? Or, more specifically, just show the /var/log/httpd/error_log section of your log file. This is usually very helpful to diagnosing things that go wrong after a successful depl... | 0 | 0 | 0 | 0 | 2014-07-16T03:29:00.000 | 1 | 0 | false | 24,771,722 | 0 | 0 | 1 | 1 | I am still new to this, so please pardon the inexperience.
I am currently developing a website with a coder using python and flask, and it needs to be placed into elastic beanstalk.
The website was developed offline, and we are trying to upload it to EB.
We have followed the instructions on the AWS support, and have be... |
django registration page with country , state field after submission | 24,777,165 | 0 | 1 | 178 | 0 | python,django,forms | I have tried your case in admin of Django. There is a request object in Django which I suppose you know what it is. You can get user selection by request.user.user_permissions.select_related(). Hope it will help you. | 0 | 0 | 0 | 0 | 2014-07-16T07:18:00.000 | 2 | 0 | false | 24,774,512 | 0 | 0 | 1 | 1 | I have created a django form using django-registration package.
In that I have two selection fields , first is country, second is state depending on the country. If I get any errors, when I submit the form it returns form with user filled data.
But I am facing problems with selection field of country and state.
Plea... |
How to run a python function on every Admin page load in Django | 24,782,492 | 0 | 2 | 1,889 | 0 | python,django,python-3.x,django-admin | I would deal it with a simple way. Find a function the admin must execute such as save_model(). Then put your own function in it. | 0 | 0 | 0 | 0 | 2014-07-16T13:40:00.000 | 3 | 0 | false | 24,782,368 | 0 | 0 | 1 | 1 | I would like a python function to be run any time a page from the admin interface is loaded. This does not need to run on every page load(ie non-admin related pages). This function requires the request object or the user id.
I know I could create a new view and call it from javascript from the page, but this seems li... |
How do I find where a django template variable comes from in the python | 24,796,873 | 1 | 0 | 668 | 0 | python,django,django-templates,django-views | Look at the URL of the page. Then go to urls.py and look at which view is linked to the URL. Then open views.py and search for the view which the URL linked to.
In that view, the variable 'x' should be there. If it's not, then check the template context processors and middlewares as karthikr suggested. | 0 | 0 | 0 | 0 | 2014-07-16T17:44:00.000 | 1 | 1.2 | true | 24,787,347 | 0 | 0 | 1 | 1 | Is there a good general way of finding the line of python code responsible for passing in variables to django templates? When newly picking up a large code base, and I see {{ x.y }} in the template, and nothing obviously related (by how things are named) to x in the {% load ... %}, what do I do? Where can I find this ... |
Google App Engine send batch email | 24,814,266 | 1 | 0 | 88 | 0 | python,google-app-engine,email | You can set up a CRON job to run every few minutes and process your email queue. It will require an endpoint where you can send a POST request, but you can use a secret token (like just any random guid) to verify the request is legitimate before you send the email. | 0 | 1 | 0 | 0 | 2014-07-17T14:45:00.000 | 1 | 1.2 | true | 24,806,675 | 0 | 0 | 1 | 1 | I was wondering how I would go about emailing user emails stored in a python datastore.
Should I create a sort of maintenance page where I can log in as an administrator and then send an email or is there a way for me to execute a python script without needing a handler pointing to a separate webpage so I don't have t... |
Streaming audio from webserver | 24,811,718 | 0 | 0 | 452 | 0 | python,ios,audio,streaming | What happens when the playback is restarted? Print the HTTP URLs on the server. Does the player start from index=0, go to index=4000, then back to index=0 again? | 0 | 1 | 0 | 0 | 2014-07-17T18:27:00.000 | 1 | 0 | false | 24,810,929 | 0 | 0 | 1 | 1 | I'm creating a simple app that can play audio files (currently only mp3 files) located on a webserver.
Currently, I'm using Python's SimpleHTTPServer server side, and the AVAudioPlayer for iOS.
It sort of works, since the file is streamed over HTTP instead of just being downloaded from the webserver. But I often experi... |
beautifulsoup in python3.4 cannot use in pycharm | 24,818,385 | 1 | 2 | 2,453 | 0 | python,python-3.x,ubuntu | pip install beautifulsoup4 does not work?
Did you try to create a new virtualenv in pycharm and simple add library? | 0 | 0 | 0 | 0 | 2014-07-18T06:07:00.000 | 2 | 0.099668 | false | 24,818,249 | 1 | 0 | 1 | 2 | I am using ubuntu14.0LTS and pycharm IDE how to download and install beautifulsoup and add beautifulsoup library into pycharm.
I tried using pip install it's not working. |
beautifulsoup in python3.4 cannot use in pycharm | 29,523,112 | -1 | 2 | 2,453 | 0 | python,python-3.x,ubuntu | THis is how I found it,
First I click on file in the top menu.
then I click on settings, now look for project interpreter this where you can add beautifulsoup by clicking on the green cross on the right site of the screen.
After installing it. Call it by using : from bs4 import beautifulsoup | 0 | 0 | 0 | 0 | 2014-07-18T06:07:00.000 | 2 | -0.099668 | false | 24,818,249 | 1 | 0 | 1 | 2 | I am using ubuntu14.0LTS and pycharm IDE how to download and install beautifulsoup and add beautifulsoup library into pycharm.
I tried using pip install it's not working. |
What's the appropriate way to use Flask with zeromq in production? | 24,890,173 | 2 | 6 | 3,408 | 0 | python,flask,zeromq | Is the ZMQ socket in your app connect()-ing, or is it bind()-ing? If your app is considered the client and it's connecting, then multiple instances should be able to connect without issue. If it's considered the server and it's binding, then yes, you'll have problems... but in your case, it seems like you should cons... | 0 | 0 | 0 | 0 | 2014-07-18T21:08:00.000 | 3 | 0.132549 | false | 24,833,833 | 0 | 0 | 1 | 2 | I have a Flask app that accepts HTTP requests. When certain HTTP requests come in, I want to trigger a message on a zeromq stream. I'd like to keep the zeromq stream open all the time. I'm wondering what the appropriate way to do this is. Since it is recommended to use gunicorn with Flask in production, doesn't that me... |
What's the appropriate way to use Flask with zeromq in production? | 24,834,017 | 0 | 6 | 3,408 | 0 | python,flask,zeromq | ZeroMQ shall not reuse context across different threads. The same applies to sockets.
If you manage to keep the socket used exclusively by one thread in worker, you might reuse the
socket.
Anyway, I would start with creating new context and socket with every request and see, if there is
any need to go into complexities... | 0 | 0 | 0 | 0 | 2014-07-18T21:08:00.000 | 3 | 0 | false | 24,833,833 | 0 | 0 | 1 | 2 | I have a Flask app that accepts HTTP requests. When certain HTTP requests come in, I want to trigger a message on a zeromq stream. I'd like to keep the zeromq stream open all the time. I'm wondering what the appropriate way to do this is. Since it is recommended to use gunicorn with Flask in production, doesn't that me... |
How can I force splinter to use a default browser? | 30,110,730 | 0 | 0 | 128 | 0 | android,python,iframe,selenium,splinter | You can provide it as the argument when you instantiate the splinter browser object. | 0 | 0 | 1 | 0 | 2014-07-20T00:45:00.000 | 1 | 0 | false | 24,846,309 | 0 | 0 | 1 | 1 | I've searched thoroughly and still can't find the answer to this question. I finally figured out how to prefill a form in an iframe using splinter, but it only works in firefox on my computer, while not working in another browser, let alone a mobile device. I've tried importing webdriver from selenium, etc. Still, noth... |
How to return HTTPMovedPermanently (301 status) instead HTTPFound (302) in pyramid notfound_view_config | 24,882,407 | 1 | 2 | 390 | 0 | python,pyramid,http-status | My solution with deprecated class:
class append_slash_notfound_factory(AppendSlashNotFoundViewFactory):
def __call__(self, context, request):
result = super(append_slash_notfound_factory, self).__call__(context, request)
if isinstance(result, HTTPFound):
return HTTPMovedPermanently(resul... | 0 | 0 | 0 | 0 | 2014-07-21T12:47:00.000 | 2 | 0.099668 | false | 24,865,495 | 0 | 0 | 1 | 1 | Using notfound_view_config in pyramid with parameter append_slash=True, i get 302 http status when redirecting, but i want set custom http status - 301.
@notfound_view_config(append_slash=True, renderer="not_found.mako")
def notfound(request):
return {} |
Python SimpleHttpServer howto | 42,041,564 | 1 | 0 | 2,367 | 0 | javascript,jquery,python,html,simplehttpserver | I hope starting python server in the correct folder path of index.html file should solve the issue.
P.S I have faced the same issue and realised that I have started the python server in the parent folder of index.html file which didn't have the script.js file | 0 | 0 | 0 | 0 | 2014-07-21T17:56:00.000 | 1 | 0.197375 | false | 24,871,598 | 0 | 0 | 1 | 1 | I have: I created index.html - the simplest html page & launch my simple http server with python -m SimpleHttpServer 8000.
I want: make index.html use javascript which depends on JQuery.
Problem: Seems SimpleHttpServer doesn't load JS files. I mean if I write <script src="myScript.js"/> inside index.html - myScript.j... |
Python Flask webserver stop responding | 42,686,598 | 0 | 12 | 9,757 | 0 | python,flask | In my case, I need to change worker_class from 'sync' to 'gevent', since I do some asynchronous tasks. Then no more hangs. | 0 | 0 | 0 | 0 | 2014-07-22T10:28:00.000 | 3 | 0 | false | 24,884,901 | 0 | 0 | 1 | 2 | I am running a flask web server, it works fine during testing, but now freezes at least once per day. All I need to do is to restart it and it will work again. Is there a good way to monitor it and maybe I should just kill/restart it every time it fails. Do people actually kill their web server periodically to avoid th... |
Python Flask webserver stop responding | 26,342,720 | 3 | 12 | 9,757 | 0 | python,flask | While the default web server might not be the best for production, it is probably not the root cause of the crashes. I use it in a production environment on an internal network and it is very stable. Before blaming the web server check to make sure your code can handle requests that that may collide with each other.... | 0 | 0 | 0 | 0 | 2014-07-22T10:28:00.000 | 3 | 0.197375 | false | 24,884,901 | 0 | 0 | 1 | 2 | I am running a flask web server, it works fine during testing, but now freezes at least once per day. All I need to do is to restart it and it will work again. Is there a good way to monitor it and maybe I should just kill/restart it every time it fails. Do people actually kill their web server periodically to avoid th... |
make a Client-Server application | 24,893,137 | 1 | 0 | 136 | 0 | python,url,client-server,client,webclient | The "action" part of a form is an url, and If you don't specify the scheme://host:port part of the URL, the client will resolve it has the current page one. IOW: just put the path part of your script's URL and you'll be fine. FWIW hardcoding the scheme://host:port of your URLs is an antipattern, as you just found out. | 0 | 0 | 1 | 0 | 2014-07-22T14:54:00.000 | 2 | 0.099668 | false | 24,890,739 | 0 | 0 | 1 | 2 | I used to create web app in the same computer, but if the server and the client is not in the same computer, how can we access to the web page ?
I mean, for example I have an html form and a button "ok" :
If the server and the client are in the same computer, in action = " " we put localhost/file.py , but if the server... |
make a Client-Server application | 24,907,187 | 0 | 0 | 136 | 0 | python,url,client-server,client,webclient | Your script is supposed to be run as a CGI script by a web-server, which sets environment variables like REMOTE_ADDR, REQUEST_METHOD ...
You are running the script by yourself, and this environment variable are not available.
That's why you get the KeyError. | 0 | 0 | 1 | 0 | 2014-07-22T14:54:00.000 | 2 | 1.2 | true | 24,890,739 | 0 | 0 | 1 | 2 | I used to create web app in the same computer, but if the server and the client is not in the same computer, how can we access to the web page ?
I mean, for example I have an html form and a button "ok" :
If the server and the client are in the same computer, in action = " " we put localhost/file.py , but if the server... |
django models and OOP design | 24,898,191 | 0 | 0 | 1,085 | 0 | python,django,oop,django-models | You should put the methods of the Quest class on the model itself and get rid of the Quest class. | 0 | 0 | 0 | 0 | 2014-07-22T21:25:00.000 | 1 | 1.2 | true | 24,898,132 | 0 | 0 | 1 | 1 | I wrote a quest system for an online game. My quests are serialized into json objects for a JavaScript client that fetches those quests then from a REST backend (I use django RestFramework)
Now I'm wondering on which class or django model I should put the "behaviour" that belongs to the data.
I stored the data that bel... |
How to use the Django ORM for creating an interface like MySQL admin that connects to multiple databases | 24,917,828 | 0 | 0 | 110 | 1 | django,mysql-python,django-orm,cx-oracle | Django uses connection pooling (i.e. few requests share the same DB connection). Of course, you can write a middleware to close and reinitialize connection on every request, but I can't guarantee you will not create race conditions, and, as you said, there is no point to do so.
If you want to make automatic multi-datab... | 0 | 0 | 0 | 0 | 2014-07-23T13:38:00.000 | 1 | 1.2 | true | 24,912,020 | 0 | 0 | 1 | 1 | So I'm fairly new to Django development and I started using the cx_Oracle and MySQLdb libraries to connect to Oracle and MySQL databases. The idea is to build an interface that will connect to multiple databases and support CRUD ops. The user logs in with the db credentials for the respective databases. I tried not usi... |
Best way to find the location of a config file based from launching directory? | 24,915,117 | 3 | 0 | 241 | 0 | python,configuration | If you want to get the path to file that has your code relative to from where it was launched, then it is stored in the __file__ of the module, which can be used if you:
dont want your module(s) to be installed with a setup.py/distutils
scheme.
and want your code + configs contained in one location.
So a codeDir = os... | 0 | 0 | 0 | 1 | 2014-07-23T15:20:00.000 | 1 | 1.2 | true | 24,914,489 | 1 | 0 | 1 | 1 | I'm developing a module right now that requires a configuration file.
The configuration file is optional and can be supplied when the module is launched, or (ideally) loaded from a defaults.json file located in the same directory as the application. The defaults.json file's purpose is also used to fill in missing keys... |
Best practice to upgrade a Plone 3 theming product to Plone 4 | 25,017,085 | 0 | 0 | 44 | 0 | python,themes,plone,product,theming | If you want the traditional editing interface, old-style theme packages are helpful. If you have HTML resources ready from the designer, and want them quickly deployed, Diazo seems a fit. Anyway, Sunburst is the Plone 4 default theme package, you should check it out thoroughly and take advantage from the stock Plone pa... | 0 | 0 | 0 | 0 | 2014-07-23T17:49:00.000 | 1 | 0 | false | 24,917,458 | 0 | 0 | 1 | 1 | I have several sites in Plone 3.3.5 with its own theming product for each site, designed by an outside contractor long ago. Would it be best that I try to upgrade these theming products to Plone 4 compatible or should I use the new Diazo tool built into Plone 4 to create these different themes for each site?
Thanks in ... |
Having error queues in celery | 24,946,459 | 0 | 4 | 1,656 | 0 | python,celery,reliability | I had a similar problem and i solved it may be not in a most efficient way but however my solution is as follows:
I have created a django model to keep all my celery task-ids and that is capable of checking the task state.
Then i have created another celery task that is running in an infinite cycle and checks all tasks... | 0 | 1 | 0 | 0 | 2014-07-24T14:35:00.000 | 2 | 0 | false | 24,936,671 | 0 | 0 | 1 | 1 | Is there any way in celery by which if a task execution fails I can automatically put it into another queue.
For example it the task is running in a queue x, on exception enqueue it to another queue named error_x
Edit:
Currently I am using celery==3.0.13 along with django 1.4, Rabbitmq as broker.
Some times the task fa... |
Reasons why Django was slow | 24,937,984 | 3 | 2 | 431 | 0 | python,database,django,performance | It all depends on the query that you're running. If you're running a SELECT COUNT(*) FROM foo on a table that has ten rows, it's going to be very fast; but if your query involves a dozen joins, sub-selects, filters on un-indexed rows--or if the target table simply has a lot of rows--the query can take an arbitrary amou... | 0 | 0 | 0 | 0 | 2014-07-24T15:25:00.000 | 1 | 1.2 | true | 24,937,897 | 0 | 0 | 1 | 1 | This is simply a question of curiosity. I have a script that loads a specific queryset without evaluating it, and then I print the count(). I understand that count has to go through so depending on the size it could potentially take some time, but it took over a minute to return 0 as the count of an empty queryset Why ... |
How can a Spotfire data table be sent to a web service as csv and then replace the data table with the service response? | 28,900,283 | 1 | 1 | 1,721 | 0 | web-services,ironpython,spotfire | I have addressed the similar problem but I was using different approach than the proposed IronPython script behind a button.
In my case I created a standalone C#/ASP.NET web application and I have embedded the Spotfire Web Player into the application.
I used the Spotfire JavaScript API to pick up the data marked by use... | 0 | 0 | 0 | 0 | 2014-07-24T18:04:00.000 | 2 | 0.099668 | false | 24,940,938 | 0 | 0 | 1 | 1 | I need to send my Spotfire data table to a web service as csv and then replace the data table with the service response. I assume that this can be done with IronPython behind a button. Any ideas how? |
Check box in Django admin run a Python function on save without a BooleanField | 24,944,279 | 0 | 0 | 300 | 0 | python,django,django-models,django-forms,django-admin | You can add any arbitrary fields to a form: they need to be form fields (eg forms.BooleanField) but as long as they don't also exist on the model they won't be saved.
You can then take any action you like in the form's clean() method, or in the modeladmin's save_form method. | 0 | 0 | 0 | 0 | 2014-07-24T21:03:00.000 | 1 | 0 | false | 24,943,916 | 0 | 0 | 1 | 1 | Is there a way to have a check box appear in Django admin, but instead of associating it with a BooleanField, having it run a function if it is / is not checked upon save? I don't need to store a Boolean in the database, but may need to store something depending on other fields, and whether the check box was checked.
I... |
Django - Load template with jQuery into variable | 24,945,629 | 1 | 1 | 145 | 0 | javascript,jquery,python,django | If I understand correctly, you are trying to hide jquery code.
You can't hide jquery code from the user, because django processes python code before it serves up the template, there's no way to protect jquery code with python. Really the best thing you can do is to minimize and obfuscate the code, but that only makes ... | 0 | 0 | 0 | 0 | 2014-07-24T21:18:00.000 | 1 | 1.2 | true | 24,944,148 | 0 | 0 | 1 | 1 | I'm working with a client that has a view that, after a user logs in, this view loads a template, that dynamically draws a canvas with jQuery, and generates an image copy of the canvas.
They want to protect the jQuery code, hiding the process in the python code.
I tried using PyExecJS, but it doesn't support jQuery, si... |
Django Database Module | 24,997,975 | 1 | 0 | 56 | 1 | database,django,mysql-python,django-database | For working inside virtualenv you need to install
pip install MySQL-python==1.2.5 | 0 | 0 | 0 | 0 | 2014-07-24T22:10:00.000 | 2 | 0.099668 | false | 24,944,869 | 0 | 0 | 1 | 2 | I am developing a system that will need to connect from a remote mysql database on the fly to do a specific task. To accomplish this, I am thinking to use Mysql-db module in python. Since the remote database is not part of the system itself I do not prefer to add it on the system core database settings (DATABASES setti... |
Django Database Module | 24,997,774 | 0 | 0 | 56 | 1 | database,django,mysql-python,django-database | MySQLdb is the best way to do this. | 0 | 0 | 0 | 0 | 2014-07-24T22:10:00.000 | 2 | 1.2 | true | 24,944,869 | 0 | 0 | 1 | 2 | I am developing a system that will need to connect from a remote mysql database on the fly to do a specific task. To accomplish this, I am thinking to use Mysql-db module in python. Since the remote database is not part of the system itself I do not prefer to add it on the system core database settings (DATABASES setti... |
How do I remove/add the python interpreter from eclipse? | 24,973,729 | 0 | 1 | 1,345 | 0 | python,django,eclipse,interpreter | On the menubar go to Window -> Preferences -> Pydev -> Interpreters -> Python
Remove the interpreter and click on Quick Auto Config.
That should do the trick. Make sure django is installed first. | 0 | 0 | 0 | 0 | 2014-07-26T17:19:00.000 | 1 | 0 | false | 24,973,568 | 1 | 0 | 1 | 1 | I'm an eclipse noob.
After adding PyDev to eclipse, I try to create a "PyDev Django Project", but and I get the "Django not found" error.
I heard that you have to remove the python interpreter from eclipse, then add it again. But I don't know how to do that.
Can someone show me how to remove/add the python interpret... |
Sign in with Twitter: how to verify the current user is stil logged in | 25,003,619 | 0 | 0 | 36 | 0 | python,google-app-engine,twitter,webapp2 | Are you talking about being logged in to Twitter.com or your app? If you have received oAuth access tokens by authenticating an app, then logging out of twitter.com won't 'log you out' of any apps, the tokens will remain valid until the user revokes the access. | 0 | 0 | 0 | 1 | 2014-07-27T10:39:00.000 | 1 | 0 | false | 24,980,103 | 0 | 0 | 1 | 1 | I have managed to use oauth authentication and add a Sign in with Twitter functionality to a Google App Engine web app.
How should I verify, during the site navigation, if the user is still logged in Twitter? |
get input file name and file extention using flask | 24,982,070 | 20 | 6 | 6,570 | 0 | python,flask,filenames | Found the answer. request.files['upload'].filename gives the file name and extension in flask | 0 | 0 | 0 | 0 | 2014-07-27T12:56:00.000 | 2 | 1.2 | true | 24,981,184 | 0 | 0 | 1 | 1 | lets say that I have <input name="upload" type="file"> and I am uploading picture.jpg. The question is how can I get the file name+extention? By other words the correct script for request.files.filename or request.upload.filename |
Calling Django server api from android phone | 24,988,398 | 0 | 0 | 3,171 | 0 | android,python,django,api | If I understand your question correctly, you have a Django installation on your laptop and you are able to hit a specific page/service locally using "localhost:8000/polls/link/2/" and it works fine. Now you want to access it from your mobile. Correct?
Replace the "localhost" with IP address of your laptop. For example,... | 0 | 0 | 0 | 0 | 2014-07-28T01:49:00.000 | 6 | 0 | false | 24,987,488 | 0 | 0 | 1 | 2 | I am developing an android app. For local testing I have created a django server on my laptop. My problem is I am not able to call django apis from app code. For example, if I want to call any django server api from desktop I write "localhost:8000/polls/link/2/". Now how to replace this "localhost part of url" if calli... |
Calling Django server api from android phone | 47,381,501 | 0 | 0 | 3,171 | 0 | android,python,django,api | Firstly run the django server by typing python manage.py runserver 0.0.0.0:8000. Then check the ip of your private network i.e wlan ip using ifconfig command then simply replace your localhost text with that ip while calling API.
But above all make sure that your phone and lappy should be in same network. | 0 | 0 | 0 | 0 | 2014-07-28T01:49:00.000 | 6 | 0 | false | 24,987,488 | 0 | 0 | 1 | 2 | I am developing an android app. For local testing I have created a django server on my laptop. My problem is I am not able to call django apis from app code. For example, if I want to call any django server api from desktop I write "localhost:8000/polls/link/2/". Now how to replace this "localhost part of url" if calli... |
Call python FUNCTION from javascript | 24,993,506 | 2 | 0 | 4,050 | 0 | javascript,python,angularjs,client-server | It doesn't have much to do with Python, really. Your javascript code is executed on the client's brower, and all it can do is issuing HTTP requests (synchronous or asynchronous). At this point which webserver / technology / language is used to handle the HTTP request is totally irrelevant. So, from the client javascrip... | 0 | 0 | 0 | 0 | 2014-07-28T10:16:00.000 | 2 | 1.2 | true | 24,993,048 | 0 | 0 | 1 | 1 | this question have been asked numerous times, I know and I'm sorry if by ignorance I didn't get the answers.
I have a hosting plan which doesn't allow me to install django, which was really nice to call an rest api easily with the routing settings.
What I want is to be able to call a python function from javascript cod... |
Couchbase: Add View to existing Design Document | 24,997,007 | 0 | 1 | 563 | 0 | java,python,command-line,couchbase,couchbase-view | So it appears after watching how their Web UI console works, that they're essentially reusing the "create a design document," i.e. the PUT command, to overwrite the existing design document. I have no idea how this would work on a production machine while it is running or the implications of such actions. The documenta... | 0 | 0 | 0 | 0 | 2014-07-28T13:23:00.000 | 2 | 1.2 | true | 24,996,265 | 0 | 0 | 1 | 1 | I can query the views of a design document. I can create a brand new design document. I can delete a design document. I can add a view to a design document I'm in the process of creating but...
How do you add a view to an already existing design document without going through their web UI? Is it even possible or do you... |
Django cutting off uploaded file | 25,031,586 | 0 | 3 | 86 | 0 | python,ajax,django | Turns out it was a "feature" of the client-side AJAX package we were using (flow.js) and we just had to increase chunkSize. | 0 | 0 | 0 | 0 | 2014-07-28T19:45:00.000 | 1 | 1.2 | true | 25,003,108 | 0 | 0 | 1 | 1 | I'm making a Django app in which a user can upload a file (an image) using AJAX.
While developing locally, I saw that PIL, which I used to process the image after upload, had a bug. After investigating I found out it's because PIL is getting the file data cut off. It's only getting the first 1MB of the file, which is w... |
handling different required package versions | 25,006,589 | -1 | 1 | 49 | 0 | python | You have a couple of options these are the only ones I can think of:
fork (sorry but this may be the easiest/ quickest),
wait for a new version for the older package, or
change it to not use zipped eggs (I don't really understand this though).
[EDIT] could you potentially trick one into thinking that it is using its v... | 0 | 0 | 0 | 0 | 2014-07-29T00:37:00.000 | 1 | -0.197375 | false | 25,006,539 | 0 | 0 | 1 | 1 | I (thankfully) never ran into this before, and (sadly) just did.
My app now imports 2 packages, which each import the requests library. The two authors have pegged the version of requests to different versions. One wants 2.1.0 , the other wants 2.3.0.
Automated tests appear to pass on both. My app appears to functio... |
How to get data from inspect element of a webpage using Python | 25,027,442 | 0 | 6 | 34,323 | 0 | python,html,extract | BeautifulSoup could be used to parse the html document, and extract anything you want. It's not designed for downloading. You could find the elements you want by it's class and id. | 0 | 0 | 1 | 0 | 2014-07-30T01:11:00.000 | 4 | 0 | false | 25,027,339 | 0 | 0 | 1 | 1 | I'd like to get the data from inspect element using Python. I'm able to download the source code using BeautifulSoup but now I need the text from inspect element of a webpage. I'd truly appreciate if you could advise me how to do it.
Edit:
By inspect element I mean, in google chrome, right click gives us an option cal... |
How do I prevent the raw WSGI python file from being read? | 25,056,888 | 0 | 1 | 77 | 0 | python,apache,.htaccess,wsgi | You should not stick the WSGI file in the DocumentRoot directory in the first place. You have created the situation yourself. It doesn't need to be in that directory for WSGIScriptAlias to work. | 0 | 1 | 0 | 1 | 2014-07-30T16:33:00.000 | 2 | 0 | false | 25,042,205 | 0 | 0 | 1 | 2 | I am using mod_wsgi with apache to serve the python application. I have a directive in the VirtualHost entry as follows WSGIScriptAlias /app /home/ubuntu/www/app.wsgi. I also have DocumentRoot /home/ubuntu/www/. Therefore, if the user attempts to read /app.wsgi it gets the raw file. If I try to block access to it via .... |
How do I prevent the raw WSGI python file from being read? | 25,045,724 | 0 | 1 | 77 | 0 | python,apache,.htaccess,wsgi | This is far from the best option, but it does seem to work: I added WSGIScriptAlias /app.wsgi /home/ubuntu/www/app.wsgi to the VirtualHost as well so that it will run the app on that uri instead of returning the raw file. | 0 | 1 | 0 | 1 | 2014-07-30T16:33:00.000 | 2 | 0 | false | 25,042,205 | 0 | 0 | 1 | 2 | I am using mod_wsgi with apache to serve the python application. I have a directive in the VirtualHost entry as follows WSGIScriptAlias /app /home/ubuntu/www/app.wsgi. I also have DocumentRoot /home/ubuntu/www/. Therefore, if the user attempts to read /app.wsgi it gets the raw file. If I try to block access to it via .... |
Lightweight Python Web Browser | 31,276,859 | -1 | 0 | 1,135 | 0 | python,multithreading,web,browser,python-webbrowser | i have written winks-up in vala.
It's small and fast and compile well on raspbian.
All the code was optimize to reduce memory occupation.
isn't perfect but was better like nothing | 1 | 0 | 0 | 1 | 2014-07-30T20:04:00.000 | 3 | -0.066568 | false | 25,045,924 | 0 | 0 | 1 | 2 | Got a bit of weird request here, however it's one which I can't really figure out the answer to.
I'm writing a python application that displays web pages and locally stored images.
What I need is a way of displaying a web page using python that is really lightweight and quite fast. The reason for this is that it is ru... |
Lightweight Python Web Browser | 25,051,761 | 0 | 0 | 1,135 | 0 | python,multithreading,web,browser,python-webbrowser | I'd use PyQT to display the page but if the way PyQT use threads does not fit within you application, you may just write a minimalist (I'm speaking of ~10 lines of code here) web browser using PyQT, and fork it from your main application ? | 1 | 0 | 0 | 1 | 2014-07-30T20:04:00.000 | 3 | 0 | false | 25,045,924 | 0 | 0 | 1 | 2 | Got a bit of weird request here, however it's one which I can't really figure out the answer to.
I'm writing a python application that displays web pages and locally stored images.
What I need is a way of displaying a web page using python that is really lightweight and quite fast. The reason for this is that it is ru... |
How to change settings in a middleware? | 25,054,828 | 0 | 0 | 394 | 0 | python,django,apache | No, there is no way to do this, and that's a very good thing as it is a bad idea. There is no reason to use the same Apache process for different sites: instead you should have different virtual hosts for each of your sites, and let Apache manage them. | 0 | 0 | 0 | 0 | 2014-07-31T08:37:00.000 | 1 | 1.2 | true | 25,054,347 | 0 | 0 | 1 | 1 | I'd like to change the environment variable DJANGO_SETTINGS_MODULE (along with a few others) and then have ALL relevant modules like django.conf, django.db etc reloaded to reflect the information from the new settings module. The new settings module will have different database. I will be doing this in a middleware.
I ... |
Pass a request to a DJANGO REST api using Angular and then return those results in a DJANGO view | 25,067,631 | 1 | 1 | 109 | 0 | javascript,python,django,angularjs,rest | It depends on the architecture of your application.
If you are building your client as a single page web application using Angular & your business logic is served using the Django REST API in JSON/XML format. Then rendering of the view should be the responsibility of the client side code.
As per me whatever you are do... | 0 | 0 | 0 | 0 | 2014-07-31T17:03:00.000 | 1 | 1.2 | true | 25,064,876 | 0 | 0 | 1 | 1 | Ok, so basically what is happening is I have a search input on my index page. The user types something in the search input, and that is sent to the Django REST api which returns the data in JSON format. I can loop through that results array using Angular ng-repeat. But my question is: is there a way to send that reques... |
Error: No section: 'default' in Robot Framework using DatabaseLibrary | 32,266,513 | 2 | 1 | 4,534 | 1 | python-2.7,robotframework | You should check the content of dbConfigFile. You don't specify one so the default one is ./resources/db.cfg.
The error says when python try to parse that file it cannot find a section named default. In documentation it says:
note: specifying dbapiModuleName, dbName dbUsername or dbPassword directly will override the... | 0 | 0 | 0 | 0 | 2014-08-01T04:44:00.000 | 1 | 0.379949 | false | 25,072,996 | 0 | 0 | 1 | 1 | I am using Robot Framework with Database Library to test database queries on localhost. I am running it by XAMPP.
This is my test case:
*** Settings ***
Library DatabaseLibrary
*** Variables ***
@{DB} robotframework root \ localhost 3306
*** Test Cases ***
Select from database
... |
How to preserve UTF8 string from app to webserver in Python | 25,074,740 | 2 | 1 | 191 | 0 | python,utf-8 | HTTP headers are strictly 7-bit US ASCII. The RFC allows you to accept ISO8859-1as a compatibility hack, but don't send any byte beyond 127.
There is no standard or best way to send any other data type beside ASCII in the headers. It is your application's responsibility to encode arbitrary sequences of bytes (and your ... | 0 | 0 | 0 | 0 | 2014-08-01T06:30:00.000 | 4 | 0.099668 | false | 25,074,173 | 0 | 0 | 1 | 2 | I have an app that submit a request to a Python webserver. The app has a UTF8 string with the following contents:
la langue franþaise.ppt
This is put into a HTTP header, and somehow converted as such:
la langue fran\xfeaise.ppt
Then Python on the web-server tried to do something with the string that maybe expects i... |
How to preserve UTF8 string from app to webserver in Python | 25,074,360 | 2 | 1 | 191 | 0 | python,utf-8 | \xfe is ISO-8859-1 encoding for þ.
While utf8 in content is widely supported, HTTP headers should be ASCII. The HTTP spec allows ISO-8859-1, but it's not recommended or reliable in tooling. Other encodings are not allowed without special escaping.
If possible, escape your special chars in a way that allows them to be t... | 0 | 0 | 0 | 0 | 2014-08-01T06:30:00.000 | 4 | 1.2 | true | 25,074,173 | 0 | 0 | 1 | 2 | I have an app that submit a request to a Python webserver. The app has a UTF8 string with the following contents:
la langue franþaise.ppt
This is put into a HTTP header, and somehow converted as such:
la langue fran\xfeaise.ppt
Then Python on the web-server tried to do something with the string that maybe expects i... |
Import Error - Pydev Eclipse | 25,087,270 | 1 | 1 | 249 | 0 | python,eclipse,pydev,importerror | For that to work you need to have init.py under 'project_dir', 'dira' and 'dirb' and then you need to set as a source folder the directory which is the parent of the 'project_dir' (and not the project_dir itself) -- and no other directories should be set as source folders.
I.e.: the source folder is the directory added... | 0 | 0 | 0 | 1 | 2014-08-01T10:46:00.000 | 1 | 0.197375 | false | 25,078,549 | 0 | 0 | 1 | 1 | I have co'd existing code from an SVN repo that uses full imports - by which I mean:
-->projectdir
-------->dira
-------------->a1.py
-------------->a2.py
-------->dirb
-------------->b1.py
Suppose a1.py imports a method from a2.py:
Normally I would simply write:
from a2 import xyz
Here they have written it as:
fro... |
Django memory leak: possible causes? | 68,154,893 | 0 | 21 | 15,649 | 0 | python,django,memory-leaks,uwsgi | Django doesn't have known memory leak issues.
I had a similar memory issue. I found that there is a slow SQL causing a high DB CPU percentage. The memory issue is fixed after I fixed the slow SQL. | 0 | 0 | 0 | 0 | 2014-08-02T00:47:00.000 | 2 | 0 | false | 25,090,573 | 0 | 0 | 1 | 1 | I've a Django application that every so often is getting into memory leak.
I am not using large data that could overload the memory, in fact the application 'eats' memory incrementally (in a week the memory goes from ~ 70 MB to 4GB), that is why I suspect the garbage collector is missing something, I am not sure though... |
Classify different versions of the same webpage | 25,090,652 | 0 | 0 | 34 | 0 | python,html,ads,adsense | If the HTML is definitely the same every time, the variations are probably being done on the client side using javascript.
The answer depends on what you mean by "classify." If you just want to know, on any given load of the page, where the widgets are, you will probably have to use something like Selenium that actuall... | 0 | 0 | 1 | 0 | 2014-08-02T00:57:00.000 | 1 | 1.2 | true | 25,090,619 | 0 | 0 | 1 | 1 | There is a webpage which when loaded uses a random placement of forms / controls / google ads. However, the set is closed--from my tests there are at least three possible variations, with two very common and the third very rare.
I would like to be able to classify this webpage according to each variation. I tried a... |
Google App Engine, Datastore and Task Queues, Performance Bottlenecks? | 25,110,135 | 1 | 2 | 158 | 0 | python,json,google-app-engine,rest,google-cloud-datastore | This is a really good question, one that I've been asked in interviews, seen pop up in a lot of different situations as well. Your system essentially consists of two things:
Savings (or writing) models to the data store
Reading from the data store.
From my experience of this problem, when you view these two things di... | 0 | 1 | 0 | 0 | 2014-08-03T22:30:00.000 | 2 | 0.099668 | false | 25,109,746 | 0 | 0 | 1 | 1 | We're designing a system that will take thousands of rows at a time and send them via JSON to a REST API built on Google App Engine. Typically 3-300KB of data but let's say in extreme cases a few MB.
The REST API app will then adapt this data to models on the server and save them to the Datastore. Are we likely to (eve... |
Adding PyDev eclipse pulgin manually | 25,133,261 | 0 | 0 | 347 | 0 | java,python,eclipse,plugins | I solved this problem:
There was no issue with either eclipse or with PyDev. It was about the Java version I had. PyDev works with JDK 7, but I had JDK 6. Due to this even after I copied the PyDev to droppins, nothing was shown up in Preferences. Once I used JDK 7, its working.
Thanks, | 0 | 1 | 0 | 0 | 2014-08-04T12:04:00.000 | 2 | 0 | false | 25,118,283 | 0 | 0 | 1 | 1 | I am on an assignment to work with Jython. I tried to install PyDev plugin to my eclipse ( Kepler service release 2 on Linux 64 bit machine )manually (dev machine doesnot have internet connection). But when I do manually by downloading .zip file and adding it as following:
Help-> Install new software ->Add -> Archie... |
Django REST Framework: Generics or ModelViewSets? | 25,138,732 | 4 | 12 | 14,838 | 0 | python,django,rest,django-rest-framework | Why there is generics if ModelViewSet gives same abilities and more?
Let me first rephrase the question a little more explicitly for you...
"Why are there Generic Views, when there are also Generic ViewSets"
Which really just comes down to a question of why REST framework supports both views and viewsets. Answer - Vie... | 0 | 0 | 0 | 0 | 2014-08-04T19:19:00.000 | 3 | 0.26052 | false | 25,125,959 | 0 | 0 | 1 | 1 | I use generics and plain urls for my REST API, but now I stuck with problem: I want custom actions, simple views to make some things with my models, like "run", "publish", etc.
ViewSet gives action decorator to create custom actions, but only in ViewSets, also, there is stepial routers, which gives us ability to simpli... |
best practice for tracking new/seen items | 25,140,245 | 0 | 0 | 60 | 0 | python,google-app-engine,google-cloud-datastore,app-engine-ndb | There's probably a few ways to go about this, and using Google Cloud SQL would probably make your life easier for this. What you could do though is add a BooleanProperty to your entity types for example, named 'New', that would be set to 'True' by default. You would need to create an algorithm that would check through ... | 0 | 0 | 0 | 0 | 2014-08-05T12:38:00.000 | 1 | 0 | false | 25,139,041 | 1 | 0 | 1 | 1 | So I'm making productivity app for myself and ppl around me. There will be a lots of different stuff related to different type groups or individual persons for different types of reasons.
Is there some best practice approach, algorythm or guidelines to do this properly that I should know before I screw everything up?
I... |
start only one flask instance using apache + wsgi | 25,143,417 | 1 | 1 | 1,457 | 1 | python,apache,flask,wsgi | The WSGIApplicationGroup directive may be what you're looking for as long as you have the wsgi app running in daemon mode (otherwise I believe apache's default behavior is to use prefork which spins up a process to handle each individual request):
The WSGIApplicationGroup directive can be used to specify which applica... | 0 | 0 | 0 | 0 | 2014-08-05T15:49:00.000 | 1 | 1.2 | true | 25,143,105 | 0 | 0 | 1 | 1 | I'm using wsgi apache and flask to run my application. I'm use from yourapplication import app as application to start my application. That works so far fine. The problem is, with every request a new instance of my application is created. That leads to the unfortunate situation that my flask application creates a new d... |
Django manage.py runserver fails to respond | 25,291,353 | 2 | 2 | 2,089 | 0 | python,django,python-2.7 | Okay, so to reiterate my last post.
There was a call to a Django service that was failing on application startup. No error was thrown, instead it was absorbed by Sentry. Those who were already using the VM on their local machines had worked around the issue.
The issue was identified by importing ipdb and calling its se... | 0 | 1 | 0 | 0 | 2014-08-05T16:14:00.000 | 1 | 1.2 | true | 25,143,621 | 0 | 0 | 1 | 1 | I'm running a vagrant box on Mac OS X. The VM is running Ubuntu 12.04, with Python 2.7 and Django 1.4.5. When I start up manage.py, I call it like this:
./manage.py runserver 0.0.0.0:8000
And if I visit http://127.0.0.1:8000 from within the VM, the text browsers I've tried report that the HTTP request has been sent an... |
Saving login screen username and password for Kivy app | 25,147,496 | 0 | 3 | 5,234 | 0 | android,python,ios,parse-platform,kivy | The answer is essentially that you must simply save the data somewhere. The details will depend on your requirements, and aren't specific to kivy - you can look up normal android or python practices.
I'm not sure exactly what android guarantees about permissions, but storing stuff in your app directory (on the main par... | 1 | 0 | 0 | 0 | 2014-08-05T20:02:00.000 | 3 | 0 | false | 25,147,323 | 0 | 0 | 1 | 1 | I am working on a Kivy app for iOS and Android and need help with keeping the user persistently logged in, even after the app is closed or killed. I am using Parse to store user credentials.
I've already added an on_pause method to the App class, but this only keeps the user logged in if the app is closed but not kille... |
Using Mako Template in Javascript | 25,156,421 | 1 | 2 | 1,595 | 0 | javascript,jquery,python,html,mako | Ajax is the "right" way to do this.
In order to insert the values into your separate Javascript file dynamically, it can no longer be served as a static file. Beyond that, it adds an extra layer of problems with security and maintainability as you have to deal with string escaping, possible script injection, and having... | 0 | 0 | 0 | 0 | 2014-08-06T09:00:00.000 | 1 | 0.197375 | false | 25,156,170 | 0 | 0 | 1 | 1 | I have a dashboard I am working on, using Python cherrypy framework and Mako template language.
I had an html file for each of dashboard pages.
There, I used Mako to pass some data to html and inline Javascript.
For example, to display the names of some processes when I only had the list of ids, I passed a Python dict ... |
Can I add a checkbox in to Model Forms in Django even if there is no Field in DB for it | 25,174,963 | 0 | 0 | 868 | 0 | django,python-2.7,django-models,django-forms | Define a Custom ModelForm by specifying model in Meta and declare the required additional field there. After that set form attribute of your Admin class with the name of YourForm. | 0 | 0 | 0 | 0 | 2014-08-07T05:28:00.000 | 2 | 0 | false | 25,174,797 | 0 | 0 | 1 | 1 | I have a model form and I need to add a checkbox to it. This checkbox is not mapped to any database field. Is this possible ? How ! |
Is twistedweb with django recommeneded | 25,198,042 | 2 | 3 | 244 | 0 | python,django,twisted,event-driven,twisted.web | Nope, unless you heavily modify django db adapters and some core component you will not get any advantage. There are some tool for simplyfing the job, but you will be on the bleeding edge trying to adapt something built with the blocking paradigm since the beginning, to something completely different.
On the other side... | 0 | 1 | 0 | 0 | 2014-08-07T07:37:00.000 | 2 | 0.197375 | false | 25,176,734 | 0 | 0 | 1 | 1 | I have a Django application which I need to deploy in a WSGI container. I can either chose an event driven app server like TwistedWeb or a process driven server like uWSGI. I completely understand the difference between an event driven and a process driven server and I know Django framework is blocking in nature.
I cam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.