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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Add content rule based on the form field value input data in Plone? | 11,633,491 | 2 | 2 | 340 | 0 | python,plone,ploneformgen | To be able to do this, you need to create 2 content rules--each with different conditions and destination folders to move the content to(using the "move to folder" action).
In the content rules, add a TALES expression condition. Then do something like:
python: request.form.get('value-to-check', False) == 'foobar'
Obv... | 0 | 0 | 0 | 0 | 2012-07-24T10:46:00.000 | 1 | 1.2 | true | 11,629,204 | 0 | 0 | 1 | 1 | I create a form using PloneFormGen.eg.
Product code: Gear-12
Value : 2000
Based on the input value i.e if Value is >5000 , move the saved data content entry to folder 1 else move the entry to folder 2.
How can the TALES expression be used to trigger this kind of content rule?
I am using Plone ver 4.1 |
python locale.setlocale fails when running apache | 11,727,380 | 1 | 0 | 958 | 0 | python,django-templates,apache2,django-views,locale | I managed to solve the problem by explicitly calling
locale.setlocale(locale.LC_ALL,'en_US.UTF-8')
I'm not sure why it wasn't working without the en_US.UTF-8 parameter as the local setting is 'en_US.UTF-8'. If anyone knows why I needed to use an explicit call when the apache process runs the code but not when I'm... | 0 | 0 | 0 | 0 | 2012-07-24T21:00:00.000 | 2 | 1.2 | true | 11,639,235 | 0 | 0 | 1 | 1 | I've got a simple Ubuntu/django/apache server set up and I'm having trouble formatting some of the numbers that I want to display in my Django templates. When I run the code locally (i.e. on my work machine) using the Django test server everything formats with no problem.
Likewise, when I open up IDLE on the server I c... |
Windmill-Without web browser | 12,344,550 | 0 | 1 | 364 | 0 | python,selenium,windmill,browser-testing | If you're looking to run Windmill in headless mode (no monitor) you can do it by running
Xvfb :99 -ac &
DISPLAY=:99 windmill firefox -e test=/path/to/your/test.py | 0 | 0 | 1 | 1 | 2012-07-25T08:17:00.000 | 1 | 0 | false | 11,645,451 | 0 | 0 | 1 | 1 | In selenium testing, there is htmlunitdriver which you can run tests without browser with. I need to do this with windmill too. Is there a way to do this in windmill?
Thank! |
Add logging to tests results in jenkins | 11,650,753 | 1 | 2 | 3,561 | 0 | python,jenkins,jython,nose | There is no way to achieve this from your tests. The report generator simply won't display the output unless there are errors.
You will have to get the sources for Jenkins itself (the JUnit runner is built into it) and patch the reporter or write your own plugin. | 0 | 1 | 0 | 0 | 2012-07-25T09:35:00.000 | 2 | 0.099668 | false | 11,646,830 | 0 | 0 | 1 | 2 | I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose wi... |
Add logging to tests results in jenkins | 11,742,115 | 2 | 2 | 3,561 | 0 | python,jenkins,jython,nose | With the latest Jenkins there is an option to save the output (Retain long standard output/error) right under the post build step belonging to JUnit. Additionally I run nose with --nocapture. This gives me a console output view on every test (an option on the left menu when I have a test opened) | 0 | 1 | 0 | 0 | 2012-07-25T09:35:00.000 | 2 | 1.2 | true | 11,646,830 | 0 | 0 | 1 | 2 | I am using nose in jenkins to test a project. If a test fails, I get a short report of the output to the console. I would like to have this output regardless of the test result. So even if the test passes I want to be able to see the tests output to stderr/stdout.
At the moment I can turn off logging by calling nose wi... |
Not able to install python mysql module | 11,653,215 | 4 | 0 | 62 | 1 | python,mysql,django | You need to install the client libraries. The Python module is a wrapper around the client libraries. You don't need to install the server. | 0 | 0 | 0 | 0 | 2012-07-25T15:19:00.000 | 1 | 0.664037 | false | 11,653,040 | 0 | 0 | 1 | 1 | i am trying to connect to mysql in django. it asked me to install the module. the module prerequisites are "MySQL 3.23.32 or higher" etc. do i really need to install mysql, cant i just connect to remote one?? |
Django DynamoDB Database backend | 11,679,929 | 6 | 8 | 6,014 | 0 | python,django,amazon-web-services,amazon-dynamodb,django-database | I think the answer is there's no easy way. Django supports relational databases, but DynamoDB is NoSQL.
There doesn't appear to be a backend for django-nonrel, an unofficial fork for non relational databases.
If you want to use amazon to host the database, you could use their RDS service and configure Django as you wo... | 0 | 0 | 0 | 0 | 2012-07-26T22:27:00.000 | 1 | 1.2 | true | 11,678,950 | 0 | 0 | 1 | 1 | Is it possible to set up an AWS DynamoDB as the database backed for a Django server?
If so, how would I go about doing this?
thanks! |
AppEngine datastore reserve ID range | 11,681,451 | 1 | 0 | 178 | 0 | python,google-app-engine,google-cloud-datastore | I found the answer: db.allocate_id_range(...) | 0 | 1 | 0 | 0 | 2012-07-27T04:15:00.000 | 1 | 1.2 | true | 11,681,354 | 0 | 0 | 1 | 1 | Is it possible to tell AppEngine Datastore to reserve a range of IDs, which should never be allocated to models? |
Twitter Bootstrap Website Deployed with GAE | 20,403,908 | 4 | 7 | 9,488 | 0 | python,google-app-engine,twitter-bootstrap,blogs | In addition to the answers above, also note that the order of declarations is important. The - url: /.* part should be the last one, in this case | 0 | 0 | 0 | 0 | 2012-07-27T04:42:00.000 | 4 | 0.197375 | false | 11,681,557 | 0 | 0 | 1 | 1 | So I'm a programming noob. I have been following many of the Udacity classes and I am slowly learning to code.
Alright so here's my question. I have built the basic HTML files of my blog using Twitter Bootstrap as it is so simple to use. Now what I would like to do is to combine the great template's that Bootstrap pro... |
How to show continuous real time updates like facebook ticker, meetup.com home page does? | 11,688,432 | 0 | 8 | 5,085 | 0 | php,python,node.js,asynchronous,real-time | You could use a poll, long-poll or if you want a push system. Easiest would be a poll. However, all solutions require client side coding.
Performance impact depends on your solution. Easiest to implement would be a poll. A poll with short frequency does effectively a request every, say 100ms ot simulate real time. A lo... | 0 | 0 | 1 | 0 | 2012-07-27T13:08:00.000 | 4 | 0 | false | 11,688,397 | 0 | 0 | 1 | 1 | How to show continuous real time updates in browser like facebook ticker, meetup.com home page does? In python, PHP, node.js and what would be the performance impact at the server side ?
Also how could we achieve the same update thing if the page is cached by an CDN like akamai? |
How can I prevent my website from being "hit-boosted"? | 11,697,490 | 2 | 4 | 216 | 0 | php,python,http,header,hit | The best way to do it is pattern-recognition, since most proxies won't tell you that they are a proxy: if you see certain spikes of traffic, flag them and don't add them to the hitcount.
Alternatively, if (s)he's using the same proxies over and over again, just blacklist those IP addresses. You could also try to detect... | 0 | 0 | 1 | 0 | 2012-07-28T01:22:00.000 | 2 | 0.197375 | false | 11,697,457 | 0 | 0 | 1 | 1 | I am making a social site where users can post content and the content has views. Whenever a user from a different IP address views the content, the view count is incremented; multiple requests coming from the same IP address do not count. However lately someone is iterating though a list of proxies or something and ar... |
How to launch Django development server with a different database setting (not default) | 11,702,027 | 5 | 5 | 1,173 | 0 | python,database,django,settings,local | You can hold 2 different settings.py and while run manage.py do :
python manage.py runserver --settings=[projectname].[settingsfile].
change the settingsfile according to your database. | 0 | 0 | 0 | 0 | 2012-07-28T14:30:00.000 | 2 | 1.2 | true | 11,701,887 | 0 | 0 | 1 | 1 | i have different configurations for django database in settings, one named "default" and one named "clean".
How i can run the development server (python manage.py runserver ip:port) binding the "clean" database setting and not the default? |
Using Regular Expression with Twill | 11,712,834 | 0 | 3 | 225 | 0 | python,regex,beautifulsoup,twill | I'd rather user CSS selectors or "real" regexps on page source. Twill is AFAIK not being worked on. Have you tried BS or PyQuery with CSS selectors? | 0 | 0 | 1 | 0 | 2012-07-29T00:57:00.000 | 2 | 0 | false | 11,705,835 | 0 | 0 | 1 | 1 | I'm currently using urllib2 and BeautifulSoup to open and parse html data. However I've ran into a problem with a site that uses javascript to load the images after the page has been rendered (I'm trying to find the image source for a certain image on the page).
I'm thinking Twill could be a solution, and am trying to ... |
Get dynamic html table using selenium & parse it using beautifulsoup | 11,707,106 | 0 | 1 | 1,222 | 0 | python,regex,selenium,webdriver,beautifulsoup | You'd need to figure out what HTTP requests the Javascript is making, and make the same ones in your Python code. You can do this by using your favorite browser's development tools, or wireshark if forced. | 0 | 0 | 1 | 0 | 2012-07-29T03:31:00.000 | 2 | 0 | false | 11,706,424 | 0 | 0 | 1 | 1 | I'm trying to get the content of a HTML table generated dynamically by JavaScript in a webpage & parse it using BeautifulSoup to use certain values from the table.
Since the content is generated by JavaScript it's not available in source (driver.page_source).
Is there any other way to obtain the content and use it? It... |
Need to create thumbnail from user submitted url like reddit/facebook | 11,748,617 | 1 | 2 | 1,630 | 0 | python,django,image | You'll first need to parse the html content for img src urls with something like lxml or BeautifulSoup. Then, you can feed one of those img src urls into sorl-thumbnail or easy-thumbnails as Edmon suggests. | 0 | 0 | 0 | 0 | 2012-07-29T21:53:00.000 | 3 | 1.2 | true | 11,713,284 | 0 | 0 | 1 | 1 | I am pretty new to Django so I am creating a project to learn more about how it works. Right now I have a model that contains a URL field. I want to automatically generate a thumbnail from this url field by taking an appropriate image from the webite like facebook or reddit does. I'm guessing that I should store this i... |
Django: Static files referring to one another. | 11,713,704 | 3 | 1 | 67 | 0 | python,django,static-files,django-staticfiles | The static file finders will collocate the contents of all of your static folders under a single root upon collection, which means you can reference static resources relatively.
For instance, if you had a logo in project/commons/static/images/logo.png, you can reuse it in a stylesheet in some other application, say pro... | 0 | 0 | 0 | 0 | 2012-07-29T22:35:00.000 | 1 | 1.2 | true | 11,713,588 | 0 | 0 | 1 | 1 | I have a directory with static files myapp/static/ and within that there are static/css,static/javascript, and static/images How can these files refere to one another? For instants, the css has to use the image files for the background of certain pages. Do you have to hard code the url? Can you do it relatively? |
Generate a pdf with python | 11,725,677 | 5 | 6 | 3,407 | 0 | python,pdf,latex | I would suggest using the LaTeX approach. It is cross-platform, works in many different languages and is easy to maintain. Plus it's non-commercial! | 0 | 0 | 0 | 1 | 2012-07-30T16:29:00.000 | 3 | 1.2 | true | 11,725,645 | 0 | 0 | 1 | 1 | I'm trying to develop a small script that generate a complete new pdf, mainly text and tables, file as result.
I'm searching for the best way to do it.
I've read about reportlab, which seems pretty good. It has only one drawback asfar as I can see. It is quiet hard to write a template without the commercial version, ... |
application run slowly under uwsgi threaded mode | 11,733,510 | 0 | 1 | 947 | 0 | python,memcached,uwsgi | You are probably experiencing the python GIL overhead. Try adding a second process to see if results are better. | 0 | 1 | 0 | 0 | 2012-07-31T05:06:00.000 | 1 | 0 | false | 11,733,437 | 0 | 0 | 1 | 1 | we use uwsgi + nginx to build the web site. recently, we want to improve the qps of our site, so we decide to switch uwsgi mode from prefork to threaded. but we found something very bad.
when using prefork mode with workers setting 5, we get the request time is 10-20ms. but in threaded mode(one worker 5 threads), the v... |
http server using python & gevent(not using apache) | 11,740,272 | 1 | 2 | 1,332 | 0 | python,apache,nginx,gevent,httpserver | In my opinion, you will never get the same level of security with a pure-Python server that you could have with majors web servers, as Apache and Nginx are.
These are well-tested before being released, so, by using a stable build and by configuring it properly, you will be close of the maximum of security possible.
Pur... | 0 | 0 | 0 | 1 | 2012-07-31T10:08:00.000 | 2 | 0.099668 | false | 11,737,754 | 0 | 0 | 1 | 2 | just using python & gevent.server to server a simple login server(just check some data and do some db operation), would it be a problem when it's under ddos attack?
would it be better if using apache/ngnix to server http request? |
http server using python & gevent(not using apache) | 11,740,845 | 3 | 2 | 1,332 | 0 | python,apache,nginx,gevent,httpserver | If you are using gevent.server to implement your own HTTP server, I advise against it, and you should use instead gevent.pywsgi, that provides a full-featured, stable and thoroughly tested HTTP server. It is not as fast as gevent.wsgi, which is backed by libevent-http, but has more features that you are likely to need,... | 0 | 0 | 0 | 1 | 2012-07-31T10:08:00.000 | 2 | 0.291313 | false | 11,737,754 | 0 | 0 | 1 | 2 | just using python & gevent.server to server a simple login server(just check some data and do some db operation), would it be a problem when it's under ddos attack?
would it be better if using apache/ngnix to server http request? |
Python HTML email : customizing output color-coding | 11,868,901 | 0 | 0 | 1,729 | 0 | python | All right. Her's what worked for me, just in case anybody bumps into the same problem. I had to enter carriage return (i.e. \n) after my every tag in the HTML table. And everything worked fine.
PS: One clue as to whether this will help you is that, I am creating one big string of HTML. | 0 | 0 | 0 | 1 | 2012-07-31T16:43:00.000 | 2 | 1.2 | true | 11,745,033 | 0 | 0 | 1 | 1 | I am trying to send a python (2.6) HTML email with color coded output. My script creates an output string which I format to look like a table (using str.format). It prints okay on the screen:
abcd 24222 xyz A
abcd 24222 xyz B
abcd 24222 xyz A
abcd 24222 xyz D
But I also need to send it as an email message and I need to... |
SQLAlchemy - Query show results where records exist in both table | 11,747,157 | 1 | 1 | 144 | 1 | python,sqlalchemy | If there is a foreign key defined between tables, SA will figure the join condition for you, no need for additional filters.
There is, and i was really over thinking this. Thanks for the fast response. – Ominus | 0 | 0 | 0 | 0 | 2012-07-31T18:24:00.000 | 2 | 1.2 | true | 11,746,610 | 0 | 0 | 1 | 1 | I have an items table that is related to an item_tiers table. The second table consists of inventory receipts for an item in the items table. There can be 0 or more records in the item_tiers table related to a single record in the items table. How can I, using query, get only records that have 1 or more records in item... |
many selects (dropdowns) on html form, how to get just the value of the select that was changed | 11,755,603 | 1 | 0 | 130 | 0 | javascript,python,html,forms,cgi | If every select should be the only value that's needed, then every select is basically a form on its own.
You could either remove all other selects when you activate a single select (which is prone to errors), or simply put every select in its own form instead of using one giant form. Otherwise all data is going to be ... | 0 | 0 | 1 | 0 | 2012-08-01T08:34:00.000 | 1 | 1.2 | true | 11,755,474 | 0 | 0 | 1 | 1 | In a python cgi script I have many selects in a form (100 or so), and each select has 5 or 6 options to choose from. I don't want to have a separate submit button, so I am using onchange="submit();" to submit the form as soon as an option is selected from one of the many selects. When I read the form data with form.... |
Django: writing test for multiple database site | 11,758,203 | 0 | 0 | 1,276 | 0 | python,django | I finally get the tests running, here's what I did:
disabled DATABASE_ROUTERS settings when running tests
maintain B alias in DATABASES settings but the name is the same as A
append B's INSTALLED_APPS that aren't present to A's INSTALLED_APPS | 0 | 0 | 0 | 0 | 2012-08-01T09:13:00.000 | 2 | 0 | false | 11,756,115 | 0 | 0 | 1 | 1 | I have 2 sites: A and B. A relies on some tables from B so it has an entry in its DATABASES settings pointing to B together with some entries under its DATABASE_ROUTERS settings to route certain model access to B's database.
Now I'm trying to write a test on A but just running manage.py test immediately fails because s... |
python interpreter on non-pydev projects? | 11,758,291 | 0 | 1 | 113 | 0 | python,eclipse,pydev | PyDev should be working fine. In project properties, you can set interpreter, PYTHONPATH and other PyDev related settings.
To manually trigger code analysis, right-click on project, file or folder and select PyDev->Code analysis | 0 | 0 | 0 | 1 | 2012-08-01T09:18:00.000 | 1 | 0 | false | 11,756,207 | 1 | 0 | 1 | 1 | we have successfully added pydev plugin on our eclipse. as a result in pydev projects it detects errors and so on.
but the question is that is there any way that we use pydev abilities (e.g. error detection) in non-pydev projects?(e.g. a java project).
actually we are developing an eclipse plugin that contains some .py... |
Which Python framework is flexible and similar to CodeIgniter in PHP? | 11,760,761 | 1 | 0 | 1,400 | 0 | python,django,pylons,cherrypy | For the fastest development you may dive into Django. But Django is probably not the fastest solution. Flask is lighter. Also you can try Pyramid. | 0 | 0 | 0 | 1 | 2012-08-01T12:25:00.000 | 4 | 0.049958 | false | 11,759,164 | 0 | 0 | 1 | 1 | The requirement is to develop a HTML based facebook app. It would not be content based like a newspaper site,
but will mostly have user generated data which would be aggregated and presented from database + memcache.
The app would contain 4-5 pages at most, with different purposes.
We decided to write the app in Python... |
Maintaining a (singleton) process with mod_wsgi? | 11,768,941 | 0 | 1 | 396 | 0 | python,apache,mod-wsgi,web.py | Easy. Don't restart Apache, don't set maximum-requests and don't change the code in the WSGI script file.
Are you saying that you are seeing restarts even when you leave Apache completely untouched?
And yes it sounds like you should be re-architecting your system. A web process that takes that long to startup is crazy. | 0 | 1 | 0 | 0 | 2012-08-01T14:46:00.000 | 1 | 1.2 | true | 11,761,785 | 0 | 0 | 1 | 1 | I have a python web.py app with long (minutes) start-up time that I'd like to host with in Apache with mod_wsgi.
The long-term answer may be "rewrite the app." But in the short term I'd like to configure mod_wsgi to:
Use a single process to serve the app (I can do this with WSGIDaemonProcess processes=1),
and
Keep u... |
Memory usage in django-imagekit is unacceptable -- ideas on fixes? | 11,834,793 | 3 | 3 | 353 | 0 | python,django,image-processing,heroku,django-imagekit | Try to change image size with PIL from console and see if memory usage is ok. Image resize is a simple task, I don't believe you should use side applications. Besides, split your task into 3 tasks(3 images?). | 0 | 0 | 0 | 0 | 2012-08-01T15:15:00.000 | 1 | 1.2 | true | 11,762,290 | 0 | 0 | 1 | 1 | Django-imagekit, which I'm using to process user uploaded images on a social media website, uses an unacceptably high level of memory. I'm looking for ideas on how to get around this problem.
We are using django-imagekit to copy user uploaded images it into three predefined sizes, and saves the four copies (3 processe... |
Pass information from javascript to django app and back | 11,762,988 | 1 | 13 | 10,912 | 0 | javascript,python,ajax,django | Yes, it is possible. If you pass the id as a parameter to the view you will use inside your app, like:
def example_view (request,id)
and in urls.py, you can use something like this:
url(r'^example_view/(?P<id>\d+)/', 'App.views.example_view').
The id in the url /example_view_template/8 will get access to the result... | 0 | 0 | 0 | 0 | 2012-08-01T15:32:00.000 | 3 | 0.066568 | false | 11,762,629 | 0 | 0 | 1 | 1 | So I'm trying to basically set up a webpage where a user chooses an id, the webpage then sends the id information to python, where python uses the id to query a database, and then returns the result to the webpage for display.
I'm not quite sure how to do this. I know how to use an ajax call to call the data generated ... |
Submitting Multiple Forms At The Same Time (Edit Profile Page) | 11,764,721 | 0 | 0 | 146 | 0 | python,google-app-engine,profile | I've used django on most of my webapps, but the concept should be the same; I use ajax to send the data to the backend whenever the user hits submit (and the form returns false) so the user can keep editing it. With ajax, you can send the data to different handlers on the backend. Also, using jQuery, you can set flag... | 0 | 0 | 0 | 0 | 2012-08-01T17:37:00.000 | 1 | 1.2 | true | 11,764,579 | 0 | 0 | 1 | 1 | My question I suppose is rather simple. Basically, I have a profile. It has many variables being passed in. For instance, name, username, profile picture, and many others that are updated by their own respective pages. So one page would be used to update the profile picture, and that form would submit data from the for... |
How to use a different database host in development vs deployment? | 11,765,289 | 1 | 1 | 120 | 0 | python,django | You can have two copies of your settings.py file, one for production and one for development. Whatever you need to be the default, name it as settings.py
Just set DJANGO_SETTINGS_MODULE to the python path for the file that you would like to use.
So, if your settings files are myproject/settings.py, myproject/settings_d... | 0 | 0 | 0 | 0 | 2012-08-01T18:14:00.000 | 2 | 1.2 | true | 11,765,123 | 0 | 0 | 1 | 1 | I'm new to Python and Django and have over the past few weeks managed to set up my first deployment - a very basic site with user authentication and a few pages, which I hope to fill with content in the next couple of weeks.
I have managed to find the answer to probably 40+ questions I have encountered so far by searc... |
Parsing a utf-8 encoded web page with some gb2312 body text with Python | 11,767,390 | 1 | 0 | 587 | 0 | python,encoding,character-encoding,web-scraping,beautifulsoup | The simplest way might be to parse the page twice, once as UTF-8, and once as GB2312. Then extract the relevant section from the GB2312 parse.
I don't know much about GB2312, but looking it up it appears to at least agree with ASCII on the basic letters, numbers, etc. So you should still be able to parse the HTML str... | 0 | 0 | 1 | 0 | 2012-08-01T20:23:00.000 | 1 | 1.2 | true | 11,767,001 | 0 | 0 | 1 | 1 | I'm trying to parse a web page using Python's beautiful soup Python parser, and am running into an issue.
The header of the HTML we get from them declares a utf-8 character set, so Beautiful Soup encodes the whole document in utf-8, and indeed the HTML tags are encoded in UTF-8 so we get back a nicely structured HTML p... |
Distinguishing post request's from possible poster elements | 11,770,627 | 0 | 0 | 53 | 0 | python,html,post,bottle | You could add a hidden input field to each form on the page with a specific value. On the server side, check the value of this field to detect which form the post request came from. | 0 | 0 | 1 | 0 | 2012-08-02T02:36:00.000 | 1 | 1.2 | true | 11,770,312 | 0 | 0 | 1 | 1 | So, what issue im running into is how do i know what element of my page made a post request? I have multiple elements that can make the post request on the page, but how do i get the values from the element that created the request? It seems like this would be fairly trivial,but i have come up with nothing, and when do... |
Import data into Google App Engine in a way that is "easy" for the user of the application | 11,780,827 | 1 | 1 | 181 | 0 | python,google-app-engine,google-cloud-datastore,data-import | Have the user upload the file, then start a task that runs the import. Email results/errors to the user at the end. The other way I have done, is get the user to create the spreadsheet in google docs and have them supply the sheet key or link if it's published and then start a task that processes the spreadsheet direc... | 0 | 1 | 0 | 0 | 2012-08-02T14:00:00.000 | 2 | 0.099668 | false | 11,779,033 | 0 | 0 | 1 | 1 | Building an application using Python in GAE that handles a lot of user data such as contacts, appointments, etc...
Would like to allow users to import their old data from other applications. For example an appointment might look like:
Start time Duration Service Customer Id
2012-08-02 09:50AM, 01:00:00, ... |
ImportError: No Module Named bs4 (BeautifulSoup) | 63,454,563 | 0 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | In case you are behind corporate proxy then try using following command
pip install --proxy=http://www-YOUR_PROXY_URL.com:PROXY_PORT BeautifulSoup4 | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
ImportError: No Module Named bs4 (BeautifulSoup) | 39,798,150 | 5 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | If you use Pycharm, go to preferences - project interpreter - install bs4.
If you try to install BeautifulSoup, it will still show that no module named bs4. | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0.045423 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
ImportError: No Module Named bs4 (BeautifulSoup) | 49,884,772 | 5 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | I will advise you to uninstall the bs4 library by using this command:
pip uninstall bs4
and then install it using this command:
sudo apt-get install python3-bs4
I was facing the same problem in my Linux Ubuntu when I used the following command for installing bs4 library:
pip install bs4 | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0.045423 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
ImportError: No Module Named bs4 (BeautifulSoup) | 51,779,869 | 5 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | If you are using Anaconda for package management, following should do:
conda install -c anaconda beautifulsoup4 | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0.045423 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
ImportError: No Module Named bs4 (BeautifulSoup) | 67,411,090 | 3 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | This worked for me.
pipenv pip install BeautifulSoup4 | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0.027266 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
ImportError: No Module Named bs4 (BeautifulSoup) | 58,264,670 | 2 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | pip install --user BeautifulSoup4 | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0.01818 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
ImportError: No Module Named bs4 (BeautifulSoup) | 70,539,039 | 0 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | One more solution for PyCharm:
Go to File -> Settings -> Python Interpreter, click on plus sign and find beautifulsoup4.
Click install. | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
ImportError: No Module Named bs4 (BeautifulSoup) | 58,678,662 | 1 | 170 | 402,243 | 0 | python,beautifulsoup,flask,importerror | A lot of tutorials/references were written for Python 2 and tell you to use pip install somename. If you're using Python 3 you want to change that to pip3 install somename. | 0 | 0 | 0 | 0 | 2012-08-02T18:47:00.000 | 22 | 0.009091 | false | 11,783,875 | 1 | 0 | 1 | 8 | I'm working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has "No Module Named bs4." Any comments or advice is greatly appreciated. |
Django:How to stop a form from showing up when user enters the direct url of the page containing the form? | 11,785,422 | 0 | 0 | 55 | 0 | python,django,url | Can you just use HTTP verbs?
If both of your entries into the URL are from forms, then you could simply not support GET access to that URL at all. | 0 | 0 | 0 | 0 | 2012-08-02T20:18:00.000 | 1 | 0 | false | 11,785,116 | 0 | 0 | 1 | 1 | Suppose I have two modelforms 'A' and 'B' associated with models 'C' and 'D' respectively.Model 'D' has a foreign key of model 'C'.So objects of models should be created first.Now when user submits form 'A',an object of 'C' is generated.Now to send the id of object of model 'C' I'm using a url like this "/{{ object.id ... |
django-admin.py: command not found | 24,193,778 | 1 | 3 | 6,301 | 0 | python,django,django-admin | i have the same Problem. the django-admin.py for me was in this Path ~/.local/bin.
this because i run pip instal --user django | 0 | 1 | 0 | 0 | 2012-08-03T07:41:00.000 | 3 | 0.066568 | false | 11,791,368 | 0 | 0 | 1 | 1 | I have django-admin.py in usr/local/bin and I have tried all the help given on the web to make a symbolic link but it still says django-admin.py: command not found.
I am trying to start of my first project in django :- django-admin.py startproject mysite.
No matter what I do I just keep on getting django-admin.py: com... |
Can I run PHP and Python on the same Apache server using mod_vhost_alias and mod_wsgi? | 36,646,397 | 0 | 3 | 6,266 | 1 | php,python,apache,mod-vhost-alias | Even I faced the same situation, and initially I was wondering in google but later realised and fixed it, I'm using EC2 service in aws with ubuntu and I created alias to php and python individually and now I can access both. | 0 | 0 | 0 | 1 | 2012-08-03T12:53:00.000 | 2 | 0 | false | 11,796,126 | 0 | 0 | 1 | 1 | I currently run my own server "in the cloud" with PHP using mod_fastcgi and mod_vhost_alias. My mod_vhost_alias config uses a VirtualDocumentRoot of /var/www/%0/htdocs so that I can serve any domain that routes to my server's IP address out of a directory with that name.
I'd like to begin writing and serving some Pyth... |
python Django custom error msg for any error (apart from try,except) | 11,799,755 | 0 | 0 | 480 | 0 | python,django | In Django, if an error occurs, it isn't actually propagated to the user automatically. Rather, if you have an error occur, it returns a 500 error page. If Django is in debug mode, it will give a traceback. If the other server is intelligent, it will realized that there is a 500 error message instead of a 200 message... | 0 | 0 | 0 | 0 | 2012-08-03T13:06:00.000 | 2 | 1.2 | true | 11,796,333 | 0 | 0 | 1 | 1 | in django, whenever an error is occured , if we dont keep in try block, an error will be raised . At that point of time(during error), if it is not in try block, instead of the error page, can we display a msg .
What I am actually saying is, is there anything in django(like signals) that gets activated during error an... |
python bottle css image and css routing | 11,800,422 | 4 | 1 | 1,803 | 0 | python,python-2.7,bottle | In order for a webbrowser to be able to download and render the css or image, it will either have to be part of your page (where people can view it by viewing the source of the page) or accessible at a URL.
So if you're trying to get around people being able to look at just your css or just your image, the answer is th... | 0 | 0 | 0 | 0 | 2012-08-03T17:07:00.000 | 2 | 1.2 | true | 11,800,219 | 0 | 0 | 1 | 1 | How would I go about linking css and images to a template without routing it through bottle (@route('/image/') or @route('/css/')) and using a static_file return? because i am unable to link css normally (it cant find the css/image) and if i do it through static_file anyone can go to that link and view the css/image (I... |
Which is more expensive (in $): database memory or processing power? | 11,806,820 | 4 | 3 | 612 | 0 | python,postgresql,heroku,hosting | Difficult to answer without testing it out but you might want to answer these questions:
1) How expensive is the diff operation? Run a test or compute the complexity. If diff operation is on really large files or rapidly changing files, you might want to modify the algorithm. Storing diffs doesn't seem like a great sol... | 0 | 0 | 0 | 0 | 2012-08-04T07:12:00.000 | 3 | 1.2 | true | 11,806,700 | 0 | 0 | 1 | 2 | This is a fairly abstract question, I hope it is within bounds.
I'm about 5 months into my coding career in web development. I've found that there's often a tension between CPU and storage resources. Put simply, you can use less of one and more of the other, or vice versa (then throw in the speed consideration). I'm... |
Which is more expensive (in $): database memory or processing power? | 11,809,281 | 2 | 3 | 612 | 0 | python,postgresql,heroku,hosting | My suggestion would be to store the cache in DB-tables, not in memory. If the entries are referenced a lot, they will be in memory (in disk buffers). The advantage of this approach is that the diffs will be competing for a place in core with the other DB tables, which is always smarter than pre-allocating (and managin... | 0 | 0 | 0 | 0 | 2012-08-04T07:12:00.000 | 3 | 0.132549 | false | 11,806,700 | 0 | 0 | 1 | 2 | This is a fairly abstract question, I hope it is within bounds.
I'm about 5 months into my coding career in web development. I've found that there's often a tension between CPU and storage resources. Put simply, you can use less of one and more of the other, or vice versa (then throw in the speed consideration). I'm... |
Fastest way to get map coordinates in a javascript function from Django | 11,808,220 | 1 | 2 | 391 | 0 | javascript,python,django | I think the best way would be to store this data in a database, for a couple of reasons:
You will be able to perform some queries on this data, like "give me all points in the view port" or "give me all points that are 5km from some other point" - even if you don't need it now it might be very useful in the future, es... | 0 | 0 | 0 | 0 | 2012-08-04T09:44:00.000 | 1 | 1.2 | true | 11,807,565 | 0 | 0 | 1 | 1 | So...i have used a map in a project which needs coordinates to set markers to different positions. There are many options available to me to get the coordinates.
Store the coordinates in a database and use django view to get and forward the coordinates to the javascript function using an ajax response.
Store it into a... |
How to Accomplish App Version Switching Using Buildout? | 11,897,450 | 1 | 2 | 170 | 0 | python,virtualenv,buildout,gunicorn,supervisord | Just like with your point-mod_wsgi-at-a-different-folder solution, you can do the same with gunicorn/buildout. Just set up your latest buildout in a different directory, stop the old gunicorn and start the new.
There'll be a short delay between stopping the one and starting the other, of course.
Alternative: set up the... | 0 | 0 | 0 | 0 | 2012-08-05T02:46:00.000 | 1 | 1.2 | true | 11,813,585 | 0 | 0 | 1 | 1 | My application is developed with Flask and uses buildout to handle dependency isolation. I plan to use Gunicorn and supervisord as wsgi container and process manager, in front of which there is Nginx doing load balancing. Here is the problem when deploying a new version of the application: everything is builtout in a s... |
pycharm convert tabs to spaces automatically | 43,841,682 | 12 | 131 | 141,288 | 0 | python,pycharm | ctrl + shift + A => open pop window to select options, select to spaces to convert all tabs as space, or to tab to convert all spaces as tab. | 0 | 0 | 0 | 0 | 2012-08-05T11:49:00.000 | 8 | 1 | false | 11,816,147 | 1 | 0 | 1 | 5 | I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywhere because it can't convert tabs to spaces automatically is there a way to achieve this. |
pycharm convert tabs to spaces automatically | 20,491,867 | 64 | 131 | 141,288 | 0 | python,pycharm | For selections, you can also convert the selection using the "To spaces" function. I usually just use it via the ctrl-shift-A then find "To Spaces" from there. | 0 | 0 | 0 | 0 | 2012-08-05T11:49:00.000 | 8 | 1 | false | 11,816,147 | 1 | 0 | 1 | 5 | I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywhere because it can't convert tabs to spaces automatically is there a way to achieve this. |
pycharm convert tabs to spaces automatically | 54,234,510 | 6 | 131 | 141,288 | 0 | python,pycharm | ctr+alt+shift+L -> reformat whole file :) | 0 | 0 | 0 | 0 | 2012-08-05T11:49:00.000 | 8 | 1 | false | 11,816,147 | 1 | 0 | 1 | 5 | I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywhere because it can't convert tabs to spaces automatically is there a way to achieve this. |
pycharm convert tabs to spaces automatically | 66,066,077 | 1 | 131 | 141,288 | 0 | python,pycharm | Just ot note: Pycharm's to spaces function only works on indent tabs at the beginning of a line, not interstitial tabs within a line of text. for example, when you are trying to format columns in monospaced text. | 0 | 0 | 0 | 0 | 2012-08-05T11:49:00.000 | 8 | 0.024995 | false | 11,816,147 | 1 | 0 | 1 | 5 | I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywhere because it can't convert tabs to spaces automatically is there a way to achieve this. |
pycharm convert tabs to spaces automatically | 57,950,986 | 1 | 131 | 141,288 | 0 | python,pycharm | For me it was having a file called ~/.editorconfig that was overriding my tab settings. I removed that (surely that will bite me again someday) but it fixed my pycharm issue | 0 | 0 | 0 | 0 | 2012-08-05T11:49:00.000 | 8 | 0.024995 | false | 11,816,147 | 1 | 0 | 1 | 5 | I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywhere because it can't convert tabs to spaces automatically is there a way to achieve this. |
Inconsistent SignatureDoesNotMatch Amazon S3 with django-pipeline, s3boto and storages | 57,364,827 | 0 | 3 | 5,584 | 0 | python,django,amazon-s3,boto,django-storage | Simple workaround for me was to generate a new access key with only alphanumeric characters (ie no special characters such as "/", "+", etc. which AWS sometimes adds to the keys). | 0 | 0 | 0 | 0 | 2012-08-05T22:23:00.000 | 5 | 0 | false | 11,820,566 | 0 | 0 | 1 | 1 | I have 2 files compiled by django-pipeline along with s3boto: master.css and master.js. They are set to "Public" in my buckets. However, when I access them, sometimes master.css is served, sometimes it errs with SignatureDoesNotMatch. The same with master.js. This doesn't happen on Chrome. What could I be missing?
EDIT... |
Django and Bootstrap: What app is recommended? | 11,821,278 | 6 | 70 | 50,626 | 0 | python,django,twitter-bootstrap | I've been using django-crispy-forms with bootstrap for the last couple of months and it has been quite useful. Forms render exactly as they're meant to. If you do any custom form rendering though, be prepared to define your forms in code rather than in template, using helpers. | 0 | 0 | 0 | 0 | 2012-08-05T23:52:00.000 | 4 | 1 | false | 11,821,116 | 0 | 0 | 1 | 1 | I want to start using Twitter's Bootstrap for a recently started Django app. I have quite a bit of experience with Django, but I'm totally new to Bootstrap.
What's the best way to proceed? Are there any particular Boostrap apps for Django you would recommend or have experience with?
I understand that I could use Bootst... |
Python multiprocessing and Django - I'm confused | 11,823,901 | 0 | 1 | 685 | 0 | python,django,multiprocessing | You can try celery as it's django friendly.
But if to be honest i'm not fond of it (bugs :)
We are going to switch to Gearman.
Writing your own job producers and consumers (workers) are a kind of a fun! | 0 | 0 | 0 | 0 | 2012-08-06T06:42:00.000 | 2 | 0 | false | 11,823,586 | 1 | 0 | 1 | 1 | I'm trying to write a Web app in Python, which is to consist of two parts:
A Django-based user interface, which allows each user to set up certain tasks
Worker processes (one per user), which, when started by the user, perform the tasks in the background without freezing the UI.
Since any object I create in a view is... |
Selectively indexing subdomains | 11,829,421 | 1 | 0 | 134 | 0 | python,seo,indexing,robots.txt,googlebot | No. The search engine should not care what script generates the pages. Just so long as the pages generated by the webapps are indexed you should be fine.
Second question:
You should create a separate robots.txt per subdomain. That is when robots.txt is fetched from a particular subdomain, return a robots.txt file that ... | 0 | 1 | 0 | 1 | 2012-08-06T13:34:00.000 | 2 | 1.2 | true | 11,829,360 | 0 | 0 | 1 | 1 | I am working on Web application, which allows users to create their own webapp in turn. For each new webapp created by my application I Assign a new Subdomain.
e.g. subdomain1.xyzdomain.com, subdomain2.xyzdomain.com etc.
All these Webapps are stored in Database and are served by a python script (say
default_script.py)... |
python: how to pass parameters to application in eclipse without using command prompt | 11,843,883 | 3 | 1 | 94 | 0 | python,django | You can create a "Run Configuration" in Eclipse to invoke manage.py. There is an "Arguments" tab that allows you to provide command line arguments. | 0 | 0 | 0 | 0 | 2012-08-07T10:18:00.000 | 1 | 0.53705 | false | 11,843,817 | 0 | 0 | 1 | 1 | I am doing project on django, and every time we have to run project we have to give commands in command prompt. Can we pass arguments to manage.py in eclipse(IDE) itself or at the runconfig.
Please throw some light on this. |
How to change ancestor of an NDB record? | 11,855,209 | 9 | 5 | 1,422 | 1 | python,google-app-engine,google-cloud-datastore | The only way to change the ancestor of an entity is to delete the old one and create a new one with a new key. This must be done for all child (and grand child, etc) entities in the ancestor path. If this isn't possible, then your listed solution works.
This is required because the ancestor path of an entity is part of... | 0 | 1 | 0 | 0 | 2012-08-07T21:04:00.000 | 1 | 1.2 | true | 11,854,137 | 0 | 0 | 1 | 1 | In the High-Replication Datastore (I'm using NDB), the consistency is eventual. In order to get a guaranteed complete set, ancestor queries can be used. Ancestor queries also provide a great way to get all the "children" of a particular ancestor with kindless queries. In short, being able to leverage the ancestor model... |
Swapy could not be used to access swing properties of swing based java application.How to access swing properties of a java application | 12,048,644 | 5 | 0 | 1,126 | 0 | python,swing,ui-automation,pywinauto | Pywinauto uses standard windows API calls. Unfortunately many UI libraries (like Swing/QT/GTK) do not respond in a typical way to the API calls used - so unfortunately pywinauto usually cannot get the control information. (I am the Author of pywinauto).
I can't give you a way to access the properties of the Swing contr... | 0 | 1 | 0 | 0 | 2012-08-08T08:07:00.000 | 1 | 1.2 | true | 11,860,280 | 0 | 0 | 1 | 1 | I am using swapy(desktop automation tool which uses pywinauto python package) to automate desktop UI activities, but swapy does not recognize the properties of a swing based java application, but it can recognize the properties of other applications like notepad windows media player etc..
can anybody please the reason ... |
Create a receipt for a user form submission | 11,879,610 | 1 | 0 | 504 | 0 | python,form-submit | @Serafeim, your approach is very good for the situation. Here are some ideas of extending it:
Make sure that the secret_word (in hashing terms it is called salt) is long enough.
Make the end function a bit more complex, e.g.
hash = h(h(username) + month + year + h(salt))
Use a bit more complex hash function, e.g. SHA... | 0 | 0 | 0 | 0 | 2012-08-09T06:11:00.000 | 1 | 1.2 | true | 11,877,666 | 1 | 0 | 1 | 1 | There is a requirement that our users should complete and submit a form once a month. So, each month we should have a form that will contain data for the triplet (username, month, year). I want our users to be able to certify that they did actually submit the form for that particular month by creating a receipt for the... |
How do I make Django use a different database besides the 'default'? | 11,878,547 | 1 | 0 | 304 | 1 | python,database,django,configuration | You can just use a different settings.py in your production environment.
Or - which is a bit cleaner - you might want to create a file settings_local.py next to settings.py where you define a couple of settings that are specific for the current machine (like DEBUG, DATABASES, MEDIA_ROOT etc.) and do a from settings_loc... | 0 | 0 | 0 | 0 | 2012-08-09T07:14:00.000 | 3 | 0.066568 | false | 11,878,454 | 0 | 0 | 1 | 1 | I am relatively new to Django and one thing that has been on my mind is changing the database that will be used when running the project.
By default, the DATABASES 'default' is used to run my test project. But in the future, I want to be able to define a 'production' DATABASES configuration and have it use that instead... |
Django:Any way to get date and name of uploaded file later? | 11,882,269 | 1 | 4 | 1,226 | 0 | python,django | You can use the original file's name as part of the file name when storing in the disk, and you probably can use the file's creation/modification date for the upload date. IMO, you should just store it explicitly in the database. | 0 | 0 | 0 | 0 | 2012-08-09T10:58:00.000 | 2 | 0.099668 | false | 11,881,900 | 0 | 0 | 1 | 1 | Is there any way to get the uploaded file date and name which we have stored into the database using forms ?
Right now I am just creating two more database tuples for name and date and storing them like this file_name = request.FILES['file'].name for file_name and storing date using upload_date = datetime.datetime.now... |
Should PostgreSQL connections be pooled in a Python web app, or create a new connection per request? | 11,889,137 | 1 | 8 | 9,082 | 1 | python,postgresql,web-applications,flask,psycopg2 | I think connection pooling is the best thing to do if this application is to serve multiple clients and concurrently. | 0 | 0 | 0 | 0 | 2012-08-09T17:48:00.000 | 5 | 0.039979 | false | 11,889,104 | 0 | 0 | 1 | 3 | I'm building a web app in Python (using Flask). I do not intend to use SQLAlchemy or similar ORM system, rather I'm going to use Psycopg2 directly.
Should I open a new database connection (and subsequently close it) for each new request? Or should I use something to pool these connections? |
Should PostgreSQL connections be pooled in a Python web app, or create a new connection per request? | 11,889,659 | 3 | 8 | 9,082 | 1 | python,postgresql,web-applications,flask,psycopg2 | The answer depends on how many such requests will happen and how many concurrently in your web app ? Connection pooling is usually a better idea if you expect your web app to be busy with 100s or even 1000s of user concurrently logged in. If you are only doing this as a side project and expect less than few hundred use... | 0 | 0 | 0 | 0 | 2012-08-09T17:48:00.000 | 5 | 0.119427 | false | 11,889,104 | 0 | 0 | 1 | 3 | I'm building a web app in Python (using Flask). I do not intend to use SQLAlchemy or similar ORM system, rather I'm going to use Psycopg2 directly.
Should I open a new database connection (and subsequently close it) for each new request? Or should I use something to pool these connections? |
Should PostgreSQL connections be pooled in a Python web app, or create a new connection per request? | 61,078,209 | 0 | 8 | 9,082 | 1 | python,postgresql,web-applications,flask,psycopg2 | Pooling seems to be totally impossible in context of Flask, FastAPI and everything relying on wsgi/asgi dedicated servers with multiple workers.
Reason for this behaviour is simple: you have no control about the pooling and master thread/process.
A pooling instance is only usable for a single thread serving a set of cl... | 0 | 0 | 0 | 0 | 2012-08-09T17:48:00.000 | 5 | 0 | false | 11,889,104 | 0 | 0 | 1 | 3 | I'm building a web app in Python (using Flask). I do not intend to use SQLAlchemy or similar ORM system, rather I'm going to use Psycopg2 directly.
Should I open a new database connection (and subsequently close it) for each new request? Or should I use something to pool these connections? |
Specify Python Version for Virtualenv in Requirements.txt | 11,890,145 | 3 | 27 | 20,644 | 0 | python,virtualenv,pip | it would be really convenient not to have to tell every new person
joining the team how to set up their virtualenv
Just add it to the normal set of instructions you give new members when the join; right in the same place when you tell them about the internal documentation wiki, the password to the wifi and the phone... | 0 | 0 | 0 | 0 | 2012-08-09T18:43:00.000 | 5 | 0.119427 | false | 11,889,932 | 1 | 0 | 1 | 1 | I'm using virtualenv to develop a django application with a team. The server we're deploying on is running python 2.6, but the default for our machines is 2.7.3. Is there any way to specify python version in the requirements.txt file, or something similar, within the code base?
I know requirements.txt is a pip thing, ... |
Preparing a pyramid app for production | 11,898,284 | 3 | 3 | 2,476 | 0 | python,pyramid,production | Well the big difference between python setup.py develop and python setup.py install. Is that install will install the package in your site-packages directory. While develop will install an egg-link that point to the directory for development.
So yeah you can technically use both method. But depending on how you did yo... | 0 | 0 | 0 | 1 | 2012-08-10T01:18:00.000 | 1 | 1.2 | true | 11,894,210 | 0 | 0 | 1 | 1 | So as I near the production phase of my web project, I've been wondering how exactly to deploy a pyramid app. In the docs, it says to use ../bin/python setup.py develop to put the app in development mode. Is there another mode that is designed for production. Or do I just use ../bin/python setup.py install. |
Testing memory usage of python frameworks in Virtualenv | 12,218,779 | 1 | 1 | 1,578 | 0 | python,memory,virtualenv,web-frameworks | It depends on how you're going to run the application in your environment. There are many different ways to run Python web apps. Recently popular methods seem to be Gunicorn and uWSGI. So you'd be best off running the application as you would in your environment and you could simply use a process monitor to see how muc... | 0 | 0 | 0 | 1 | 2012-08-10T01:37:00.000 | 3 | 0.066568 | false | 11,894,333 | 1 | 0 | 1 | 1 | I'm creating an app in several different python web frameworks to see which has the better balance of being comfortable for me to program in and performance. Is there a way of reporting the memory usage of a particular app that is being run in virtualenv?
If not, how can I find the average, maximum and minimum memory u... |
How can I check programmatically the status of my task queue in Google Appengine? | 11,903,487 | 0 | 6 | 585 | 0 | python,google-app-engine,queue | There is a task queue link on your appengine console where you can look at the pending tasks, statistics and see what's going on. | 0 | 1 | 0 | 0 | 2012-08-10T13:41:00.000 | 2 | 0 | false | 11,902,954 | 0 | 0 | 1 | 1 | I am firing up a queue to complete some tasks in Python Appengine application. Is there a way to get the status of the queue? I would like to check whether it is still running or has incomplete tasks. |
Selective user registration using django_registration? | 11,909,991 | 0 | 1 | 82 | 0 | python,django,authentication,django-registration | To limit registrations to people already in the database, you will need some way to identify them.
Require the club administrator to enter an email address for each member entered.
Require the user to supply that address when registering.
Send the registration link to that address, including the primary key of the us... | 0 | 0 | 0 | 0 | 2012-08-10T21:57:00.000 | 2 | 1.2 | true | 11,909,800 | 0 | 0 | 1 | 2 | I have a site catering to multiple clubs, and each club has administrators who maintain a database of club members. I want to limit site registration only to members who have explicitly been added to the club's database. How do I go about auto-generating and sending out registration links to members as they are added... |
Selective user registration using django_registration? | 11,909,979 | 0 | 1 | 82 | 0 | python,django,authentication,django-registration | You said you have a database of club members already, so you must have a primary key or a tuple which is unique for that database like a club registration number
which club members should know already
Tell Users to give there primary key value(club registration number) at the time of registration.
Make that club regi... | 0 | 0 | 0 | 0 | 2012-08-10T21:57:00.000 | 2 | 0 | false | 11,909,800 | 0 | 0 | 1 | 2 | I have a site catering to multiple clubs, and each club has administrators who maintain a database of club members. I want to limit site registration only to members who have explicitly been added to the club's database. How do I go about auto-generating and sending out registration links to members as they are added... |
How to deal with deployments to a single host with multiple application servers using Fabric? | 11,918,085 | 2 | 3 | 202 | 0 | python,host,fabric | It's just python so do what you need to do to keep them seperate. You can define the dir differences in a dictionary or some yaml file that's read into the script. There isn't anything made in fabric to make you do it one way nor provide any specific way to do this.
But essentially just keep in mind that it's not a DSL... | 0 | 1 | 0 | 0 | 2012-08-10T23:00:00.000 | 1 | 0.379949 | false | 11,910,295 | 0 | 0 | 1 | 1 | I have many application servers running on the same host. Every application server is installed in a different directory.
How should I tackle deployments on the servers, using Fabric? I would like to be able to perform deployments on each server separately, and on subsets of servers. Clearly the env.hosts parameter has... |
Cron job on Appengine - first time on start? | 11,918,536 | 2 | 0 | 211 | 0 | python,google-app-engine,cron | There is no "launch" the app in production as such. You deploy the app for the first time and crontab is now present and crontab scheduling is started. So I assume you really mean you would like to run the cron job every time you deploy a new version of your application in addition to the cron schedule.
The cron handl... | 0 | 1 | 0 | 1 | 2012-08-11T21:37:00.000 | 1 | 0.379949 | false | 11,917,869 | 0 | 0 | 1 | 1 | I am successfully running a cron job every hour on Google Appengine. However I would like it to start when I launch the app. Now it does the first cron job 1 hour after the start.
I am using Python. |
Migrate from JavaScript to Python on Google Apps | 11,927,684 | 3 | 2 | 157 | 0 | javascript,python,google-apps-script | From what I can tell, the JavaScript-like language is the only one offered for Google Apps Script.
You seem to have confused it with Google App Engine, which is a platform-as-a-service that you can use to write your own applications, and offers Java, Python, and Go runtime environments. It is not a scripting language f... | 0 | 0 | 0 | 0 | 2012-08-13T02:40:00.000 | 1 | 1.2 | true | 11,927,604 | 1 | 0 | 1 | 1 | I've inherited a fairly complex Googledoc spreadsheet with some scripted functionality implemented in the Google App Engine. The original coder used the JavaScript environment. Personally, I'm more comfortable with Python and I'm running into all kinds of weird errors on the JavaScript environment.
I'd like to just scr... |
OpenERP : Saving field value (amount) into an account | 11,929,906 | 1 | 1 | 226 | 0 | python,openerp,accounting | You can override "pay_and_reconcile" function to write in account field, this function is called at time of Pay.
action_date_assign()
action_move_create()
action_number()
this 3 function are called at time of validating invoice.
You can override any one from this or you can add your own function . in workflow for the ... | 0 | 0 | 0 | 0 | 2012-08-13T06:20:00.000 | 2 | 1.2 | true | 11,929,073 | 0 | 0 | 1 | 1 | I'm new to OpenERP and python and I need some help saving an amount into a particular account.
I have created a field in the invoice form that calculates a specific amount based on some code and displays that amount in the field. What I want to do is to associate an account with this field, so when the invoice is valid... |
Secured communication between two web servers (Amazon EC2 with Django and Google App Engine) | 11,960,819 | 1 | 3 | 705 | 0 | python,django,google-app-engine,amazon-ec2,urllib | For server to server communication, traditional security advice would recommend some sort of IP range restriction at the web server level for the URLs in addition to whatever default security is in place. However, since you are making the call from a cloud provider to another cloud provider, your ability to permanently... | 0 | 1 | 0 | 0 | 2012-08-13T20:49:00.000 | 3 | 0.066568 | false | 11,942,094 | 0 | 0 | 1 | 2 | I have a website which uses Amazon EC2 with Django and Google App Engine for its powerful Image API and image serving infrastructure. When a user uploads an image the browser makes an AJAX request to my EC2 server for the Blobstore upload url. I'm fetching this through my Django server so I can check whether the user i... |
Secured communication between two web servers (Amazon EC2 with Django and Google App Engine) | 11,960,193 | 2 | 3 | 705 | 0 | python,django,google-app-engine,amazon-ec2,urllib | apart from the Https call ( which you should be making to transfer info to django ), you can go with AES encryption ( use Pycrypto/ any other lib). It takes a secret key to encrypt your message. | 0 | 1 | 0 | 0 | 2012-08-13T20:49:00.000 | 3 | 1.2 | true | 11,942,094 | 0 | 0 | 1 | 2 | I have a website which uses Amazon EC2 with Django and Google App Engine for its powerful Image API and image serving infrastructure. When a user uploads an image the browser makes an AJAX request to my EC2 server for the Blobstore upload url. I'm fetching this through my Django server so I can check whether the user i... |
Migrate django1.2 project to django1.4 | 11,947,415 | 0 | 1 | 168 | 0 | python,django,migration | If you're using virtualenv, just create a new virtualenv with the versions of django/python that you want, workon this virtualenv and run your testsuite against it.
BTW, you might want to be careful with the word 'migration' whilst in a Django context. Migration normally refers to model migrations with South when you'... | 0 | 0 | 0 | 0 | 2012-08-14T05:17:00.000 | 4 | 0 | false | 11,946,144 | 0 | 0 | 1 | 3 | We developed project with django version 1.2 and python 2.4. Now we want to migrate the projects into latest version (Django1.4 and python2.7).
I am very new for migration, Can anyone please advise on this.
What things do I need to take careof?
Do we need to rewrite all the code again? |
Migrate django1.2 project to django1.4 | 11,955,904 | 2 | 1 | 168 | 0 | python,django,migration | This is what we are doing (we're upgrading ~60Kloc from Django 0.97 to 1.4):
create an upgrade branch of your code
create a virtualenv for working on the upgrade
download the "next" version of Django (if you prefer small steps), or the Django version you want to end up with, and place it into your own version control ... | 0 | 0 | 0 | 0 | 2012-08-14T05:17:00.000 | 4 | 1.2 | true | 11,946,144 | 0 | 0 | 1 | 3 | We developed project with django version 1.2 and python 2.4. Now we want to migrate the projects into latest version (Django1.4 and python2.7).
I am very new for migration, Can anyone please advise on this.
What things do I need to take careof?
Do we need to rewrite all the code again? |
Migrate django1.2 project to django1.4 | 11,946,791 | -1 | 1 | 168 | 0 | python,django,migration | Python does not support backward compatibility,consider that you may get some issues on migrating to 2.7 from 2.4. | 0 | 0 | 0 | 0 | 2012-08-14T05:17:00.000 | 4 | -0.049958 | false | 11,946,144 | 0 | 0 | 1 | 3 | We developed project with django version 1.2 and python 2.4. Now we want to migrate the projects into latest version (Django1.4 and python2.7).
I am very new for migration, Can anyone please advise on this.
What things do I need to take careof?
Do we need to rewrite all the code again? |
schedule number of web dynos by time of day | 11,950,901 | 1 | 15 | 1,533 | 0 | python,django,dynamic,heroku | It's not built into the platform but should be pretty easy to implement via scheduler and using your API token. | 0 | 0 | 0 | 0 | 2012-08-14T09:15:00.000 | 3 | 0.066568 | false | 11,949,240 | 0 | 0 | 1 | 1 | Is there a way to use the Heroku scheduler to start and stop web dynos for specific periods of the day? Like say during business hours 2 dynos and at night only 1 dyno?
I really would like to avoid putting the normal user/pass credentials into the app itself, so I'm looking for a secure way to do this (apart from doing... |
How to implement Haystack across all pages in website? | 11,962,907 | 2 | 0 | 138 | 0 | python,django,django-templates | It's a good idea to have all pages extend a base template. So you can have one template (e.g. base.html) that contains the basic structure of your site (headers, footers, boilerplate). Then you can extend this template for each page of your site. (i.e. {% extends 'base.html' %}).
Following this structure, you should be... | 0 | 0 | 0 | 0 | 2012-08-15T00:41:00.000 | 1 | 1.2 | true | 11,962,749 | 0 | 0 | 1 | 1 | I'm creating a site like craigslist and need to implement a search feature where customers can search for a key term and see results. For example, searching for "lamp" will create a result page with all the posts that are related to lamps.
I'm using Haystack / Solr to search the contents. However, at the moment, users ... |
Website sync of contacts and reminders with iCloud | 11,973,429 | 1 | 4 | 1,657 | 0 | php,python,api,sync,icloud | To the best of my knowledge, there is no way to interface with iCloud directly; it can only be done through an iOS or Mac OS app, and by calling the correct iCloud Objective-C APIs with UI/NSDocument classes. Since you are not using Cocoa, let alone Objective-C, you will most likely not be able to do this. I may be wro... | 0 | 1 | 0 | 0 | 2012-08-15T13:23:00.000 | 4 | 0.049958 | false | 11,970,079 | 0 | 0 | 1 | 2 | I'm building custom CRM web based system and have integrated synchronization of contacts and reminders with Google apps and need do the same with Apple iCloud. Is there any way how to do it? I haven't find any official API for this purpose, CRM is written in PHP, but I'm able to use python for this purpose as well. |
Website sync of contacts and reminders with iCloud | 12,255,882 | 0 | 4 | 1,657 | 0 | php,python,api,sync,icloud | I would recommend that you sync using the google contacts api. Then, you can tell iPhone people to use that instead of iCloud. | 0 | 1 | 0 | 0 | 2012-08-15T13:23:00.000 | 4 | 0 | false | 11,970,079 | 0 | 0 | 1 | 2 | I'm building custom CRM web based system and have integrated synchronization of contacts and reminders with Google apps and need do the same with Apple iCloud. Is there any way how to do it? I haven't find any official API for this purpose, CRM is written in PHP, but I'm able to use python for this purpose as well. |
Regularly updated data and the Search API | 11,983,057 | 2 | 1 | 519 | 0 | google-app-engine,python-2.7,google-cloud-datastore,gae-search | It is true that the Search API's documents can include numeric data, and can easily be updated, but as you say, if you're doing a lot of updates, it could be non-optimal to be modifying the documents so frequently.
One design you might consider would store the numeric data in Datastore entities, but make heavy use of a... | 0 | 0 | 0 | 0 | 2012-08-16T02:26:00.000 | 1 | 1.2 | true | 11,979,898 | 1 | 0 | 1 | 1 | I have an application which requires very flexible searching functionality. As part of this, users will need have the ability to do full-text searching of a number of text fields but also filter by a number of numeric fields which record data which is updated on a regular basis (at times more than once or twice a minu... |
How to separate test types using Django | 11,982,939 | 1 | 1 | 545 | 0 | python,django,unit-testing,testing,django-testing | The way my company organises tests is to split them into two broad categories. Unit and functional. The unit tests live inside the Django test discovery. manage.py test will run them. The functional tests live outside of that directory. They are run either manually or by the CI. Buildbot in this case. They are still ru... | 0 | 0 | 0 | 1 | 2012-08-16T07:37:00.000 | 2 | 0.099668 | false | 11,982,638 | 0 | 0 | 1 | 1 | I have a series of tests in Django that are categorised into various "types", such as "unit", "functional", "slow", "performance", ...
Currently I'm annotating them with a decorator that is used to only run tests of a certain type (similar to @skipIf(...)), but this doesn't seem like an optimal approach.
I'm wondering ... |
Conflict resolution in ZODB | 11,996,422 | 1 | 2 | 565 | 0 | python,django,zodb | IOBucket is part of the persistence structure of a BTree; it exists to try and reduce conflict errors, and it does try and resolve conflicts where possible.
That said, conflicts are not always avoidable, and you should restart your transaction. In Zope, for example, the whole request is re-run up to 5 times if a Confli... | 0 | 0 | 0 | 1 | 2012-08-16T15:56:00.000 | 1 | 1.2 | true | 11,991,114 | 0 | 0 | 1 | 1 | I do run parallel write requests on my ZODB. I do have multiple BTree instances inside my ZODB. Once the server accesses the same objects inside such a BTree, I get a ConflictError for the IOBucket class. For all my Django bases classes I do have _p_resolveconflict set up, but can't implement it for IOBucket 'cause its... |
How to automatically capitalize field on form submission in Django? | 12,001,435 | 1 | 7 | 11,826 | 0 | python,django,sorting,django-models,django-forms | If you want to ensure your data is consistent, I'm not sure that capitalizing at the form / view level is the best way to go.
What happens when you add a Product through the admin where you're not using that form / save method? If you forget the capital, you're in for data inconsistency.
You could instead use your mo... | 0 | 0 | 0 | 0 | 2012-08-16T23:40:00.000 | 6 | 0.033321 | false | 11,996,963 | 0 | 0 | 1 | 2 | I have a ProductForm where users can add a Product to the database with information like title, price, and condition.
How do I make it so that when the user submits the form, the first letter of the title field is automatically capitalized?
For example, if a user types "excellent mattress" in the form, django saves it ... |
How to automatically capitalize field on form submission in Django? | 57,403,421 | 0 | 7 | 11,826 | 0 | python,django,sorting,django-models,django-forms | if you need all first letters of all words to capitalize use val.title() in Jeremy Lewis' answer. If you use val.capitalize() then "hello world" would be "Hello world", with title() you can get "Hello World" | 0 | 0 | 0 | 0 | 2012-08-16T23:40:00.000 | 6 | 0 | false | 11,996,963 | 0 | 0 | 1 | 2 | I have a ProductForm where users can add a Product to the database with information like title, price, and condition.
How do I make it so that when the user submits the form, the first letter of the title field is automatically capitalized?
For example, if a user types "excellent mattress" in the form, django saves it ... |
Script to open web pages, fill texts and click buttons | 28,718,663 | -2 | 1 | 4,599 | 0 | python,facebook,text,login,fill | You can also take a look at IEC which uses windows API to run an instance of Internet explorer and give commands to it. Although it may not be good for large scale automation, but it is very easy to use. | 0 | 0 | 1 | 0 | 2012-08-18T22:05:00.000 | 3 | -0.132549 | false | 12,022,570 | 0 | 0 | 1 | 1 | I'd like to write a script, preferably a Python code, to fill text areas in web pages and then click certain buttons. I've come across some solutions for this but none worked, mainly because cookies were not stored properly, for exmaple, there was a Python script to login to Facebook, which did seem to get it right in ... |
Django multiple photo download | 12,027,094 | 1 | 0 | 282 | 0 | python,django | I think the only way to do it is in the backend, because in the frontend you will only have to select which photos you want to download and send the ids or some identifiers to the server side, then retrieve those selected photos from the filesystem (based on the identifiers), compress them in a single file and return t... | 0 | 0 | 0 | 0 | 2012-08-19T13:56:00.000 | 2 | 1.2 | true | 12,027,033 | 0 | 0 | 1 | 1 | I developed a photo gallery in python, now I want to insert a new feature, "Download Multiple Photos": a user can select some photos to download and system creates a compressed file with the photos.
In your opinion: in the frontend what is the best way to send the ids? Json? input hidden? and in the backend there is a ... |
Running algorithms in compiled C/C++ code within a Java/PHP/Python framework? | 12,033,703 | 0 | 2 | 419 | 0 | java,php,c++,python,c | For Java, you can search JNI (Java Native Interface), there're a lot of guides telling how to use it. | 0 | 0 | 0 | 1 | 2012-08-19T18:27:00.000 | 4 | 0 | false | 12,028,908 | 0 | 0 | 1 | 1 | Occasionally, I have come across programming techniques that involve creating application frameworks or websites in Java, PHP or Python, but when complex algorithms are needed, writing those out in C or C++ and running them as API-like function calls within your Java/PHP/Python code.
I have been googling and searching ... |
From MongoDB to PostgreSQL - Django | 15,858,338 | 1 | 2 | 1,475 | 1 | python,django,mongodb,database-migration,django-postgresql | Whether the migration is easy or hard depends on a very large number of things including how many different versions of data structures you have to accommodate. In general you will find it a lot easier if you approach this in stages:
Ensure that all the Mongo data is consistent in structure with your RDBMS model and... | 0 | 0 | 0 | 0 | 2012-08-20T08:25:00.000 | 2 | 0.099668 | false | 12,034,390 | 0 | 0 | 1 | 1 | Could any one shed some light on how to migrate my MongoDB to PostgreSQL? What tools do I need, what about handling primary keys and foreign key relationships, etc?
I had MongoDB set up with Django, but would like to convert it back to PostgreSQL. |
To json or not to json | 12,039,958 | 1 | 1 | 151 | 0 | python,django,json | It depends entirely on what you're trying to do. render_to_response passes some data to a template to render an HTML document. simply responding with a JSON object will return a JSON object. If you want to present a usable page to a human, then use render_to_response. If you're simply passing some data to a jQuery ... | 0 | 0 | 0 | 0 | 2012-08-20T14:36:00.000 | 1 | 1.2 | true | 12,039,689 | 0 | 0 | 1 | 1 | New to Django and Python.
I am using MySQL as a backend. I have two views: an infinite scroll call that calls all the records in tableA and an autocomplete field that queries tableB and returns matching records from a column.
My infinite scroll and autocomplete were created using help from various separate tutorials ... |
Call python script from html page | 12,043,550 | 1 | 0 | 1,126 | 0 | html,ajax,django,python-3.x,cherrypy | No, you don't need a web framework, but in general it's a good idea. Django seems like brutal overkill for this. CherryPy or Pyramid or some micro framework seems better.
You can have an HTML page that calls the CherryPy server, but since this page obviously is a part of the system/service you are building, serving it ... | 0 | 0 | 1 | 0 | 2012-08-20T18:49:00.000 | 1 | 0.197375 | false | 12,043,333 | 0 | 0 | 1 | 1 | I have to make a html page with css and javascript that I have to enter a url in a form. With this url, I have to get some information from the html of the page with a Python 3.2 Script.
I start learning Python some days ago and I have some question:
I need CherryPy/Django to do that? (I'm asking because I executed a ... |
python - web2py - can't seem to find lxml - ActivePython - windows7 | 12,047,285 | 1 | 0 | 277 | 0 | python,lxml,web2py,activepython | If you are using the Windows binary version of web2py, it comes with its own Python 2.5 interpreter and is self-contained, so it won't use your system's Python 2.7 nor see any of its modules. Instead, you should switch to running web2py from source. It's just as easy as the binary version -- just download the zip file ... | 0 | 0 | 1 | 0 | 2012-08-20T23:41:00.000 | 1 | 1.2 | true | 12,046,683 | 0 | 0 | 1 | 1 | Have been using ActivePython on windows7 and lxml seems working without an issue..
There were a lot of other third party packages I had & they were working too..
Until I wanted to use it inside Web2Py.
All the others seem to be working if I copy them directly inside c:/web2py/applications/myApp/modules
With lxml, see... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.