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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Ancestors in App Engine data store
| 6,243,119 | 5 | 0 | 300 | 0 |
python,google-app-engine,datastore,ancestor
|
When you create an entity with a parent, the entities are placed in the same Entity Group. Transactions in App Engine can only work within a single entity group, so if you need transactions, you need entity groups. If you don't need transaction, you don't need entity groups (in particular, to build relationships between entities that don't need transactional capabilities, you should use ReferenceProperties, not parent-child relationships.)
| 0 | 1 | 0 | 0 |
2011-06-04T22:19:00.000
| 1 | 1.2 | true | 6,239,737 | 0 | 0 | 1 | 1 |
I've been developing for Google App Engine for a while. One of the features I've noticed but haven't had an opportunity to use yet is "ancestors" in the data store.
What would be an example of a situation where this is useful?
|
Working with django and mod_wsgi in Windows
| 6,243,058 | 1 | 0 | 543 | 0 |
python,windows,django,apache,mod-wsgi
|
The answer is: don't use Apache in development. Use the built-in development server, or perhaps gunicorn.
| 0 | 0 | 0 | 0 |
2011-06-05T12:55:00.000
| 2 | 1.2 | true | 6,243,015 | 0 | 0 | 1 | 1 |
I finished installing django on my Windows machine using Apache 2.2/Python 2.6/Django 1.3/mod_wsgi. It seems like everytime I change my Python code (such as settings.py), I need to restart Apache in order for changes to take effect.
I understood that using WSGIRestrictEmbedded should solve this issue but the docs for wsgi state about WSGIRestrictEmbedded that:
This option does not exist on Windows,
or Apache 1.3 or any other
configuration where daemon mode is not
available.
What can I do then in order to avoid restarting Apache on every change?
|
CMS or web framework a simple project
| 6,245,184 | 0 | 3 | 1,735 | 0 |
python,django,wordpress,content-management-system
|
Drupal or Joomla are your best bet. Firstly, Joomla allows you to basically drop in these features you're asking for in an install an go manner. This is the easiest way to go.
Now if you want a LOTS and LOTS customization and don't mind getting into a little code then drupal will be perfect.The great thing is that the customization possibilities are almost endless! The bad thing is that Drupal has a NOTORIOUSLY crazy templating system. It's not hard to understand but even simple things can become a real pain. But Like joomla you can avoid all this with install and go plugins. you'll have the choice.
I don't know too much about wordpress, but having looked at the developer API, it seems to assume volumes about what you intend to build on top of it. Which makes it a lot less flexible than drupal and django.
Django, well according to your question... it's everything you don't want. Also if you have gone to any of the Django CMS sites you'll see how painful it is to get them up and running. That said I'm personally a Django fanatic but I'd rather you dint run into a bad experience with it and have a horrible impression of it. so given your question i'd say Drupal!
| 0 | 0 | 0 | 1 |
2011-06-05T18:25:00.000
| 6 | 0 | false | 6,244,906 | 0 | 0 | 1 | 2 |
There's not really anything on my planned site that would require a whole lot of customization but I'm looking for something that has built in functionality for forums, comments, reviews, a blog, a database that can queried by users, and some social networking features.
I have a decent amount of experience using python so I was thinking of using Django and also learning it in the process. I realize though that this would be much more time consuming than using a CMS.
So, part of me is inclined to use a PHP based CMS like worpress or drupal. I don't have any prior experience with PHP but since all the features I'm looking for are built in, do you think this would be my fastest route to get up and running?
|
CMS or web framework a simple project
| 6,244,936 | 1 | 3 | 1,735 | 0 |
python,django,wordpress,content-management-system
|
Use a CMS, Drupal is very flexible and you can install another cms like vanilla for the forums options with a plugin.
It's al you need. But if you want a full control of your site, use a framwork like Django and you get all.
Remenber, the CMS is the fastest way to build a site.
Sorry for my english mistakes.
| 0 | 0 | 0 | 1 |
2011-06-05T18:25:00.000
| 6 | 0.033321 | false | 6,244,906 | 0 | 0 | 1 | 2 |
There's not really anything on my planned site that would require a whole lot of customization but I'm looking for something that has built in functionality for forums, comments, reviews, a blog, a database that can queried by users, and some social networking features.
I have a decent amount of experience using python so I was thinking of using Django and also learning it in the process. I realize though that this would be much more time consuming than using a CMS.
So, part of me is inclined to use a PHP based CMS like worpress or drupal. I don't have any prior experience with PHP but since all the features I'm looking for are built in, do you think this would be my fastest route to get up and running?
|
If i have to choose only one html scraping library for python, which should i choose
| 6,248,603 | 1 | 1 | 162 | 0 |
python,parsing,search,web-crawler
|
I'm using Beautiful Soup and am very happy with it. So far it answered all my scraping needs. Two main benefits:
It's pretty good at handling non-perfect HTML. Since browsers are quite lax, many HTML documents aren't 100% well-formed
In addition to high-level access APIs, it has low-level APIs which make it extendible if some specific scraping need isn't directly provided
| 0 | 0 | 1 | 0 |
2011-06-06T06:21:00.000
| 2 | 1.2 | true | 6,248,424 | 0 | 0 | 1 | 2 |
I need to do lot html parsing / scraping /search engine /crawling.
There are many libraries currently like Scrapy, Beautiful Soup, lxml , lxml2 requests, pyquery.
Now i don't want to try each of these and then decide. basically i want to follow on one and then study in detail and then use that most often.
So which library should i go for which can perform all function mentioned above. Even though there may be diff solutions for diff problems. But i want onelibrary which could do all things even though it takes time to code but should be possible
Is it possible to do indexing in lxml? Is PyQuery same as lxml or its different?
|
If i have to choose only one html scraping library for python, which should i choose
| 6,248,605 | 1 | 1 | 162 | 0 |
python,parsing,search,web-crawler
|
Since lots of HTML documents are not well-formed but rather a bunch of tags (sometimes not even properly nested) you probably want to go with BeautifulSoup instead of one of the xml-based parsers.
| 0 | 0 | 1 | 0 |
2011-06-06T06:21:00.000
| 2 | 0.099668 | false | 6,248,424 | 0 | 0 | 1 | 2 |
I need to do lot html parsing / scraping /search engine /crawling.
There are many libraries currently like Scrapy, Beautiful Soup, lxml , lxml2 requests, pyquery.
Now i don't want to try each of these and then decide. basically i want to follow on one and then study in detail and then use that most often.
So which library should i go for which can perform all function mentioned above. Even though there may be diff solutions for diff problems. But i want onelibrary which could do all things even though it takes time to code but should be possible
Is it possible to do indexing in lxml? Is PyQuery same as lxml or its different?
|
Should Django Python apps be stored in the web server document root?
| 6,248,788 | 4 | 2 | 561 | 0 |
python,django
|
No. WSGI containers don't require the scripts to be in the document root, and so to increase security in case of a transient server error they shouldn't be placed in the document root.
| 0 | 0 | 0 | 0 |
2011-06-06T07:06:00.000
| 4 | 1.2 | true | 6,248,772 | 0 | 0 | 1 | 2 |
As the title states, I'm trying to figure out the best practice for where to store application files for a Python website on the server. Document root, or no?
I come from a land of PHP. :)
EDIT - To that end, links to any material describing the best practice differences between Python and PHP are hugely appreciated.
|
Should Django Python apps be stored in the web server document root?
| 6,248,805 | 0 | 2 | 561 | 0 |
python,django
|
There's no reason to store it in the document root.
While storing the app in the doc root isn't nessescarily a security problem - if configured correctly and handled carefully - storing it outside will remove a lot of headache and configuration work.
That's the main reason not to do it.
| 0 | 0 | 0 | 0 |
2011-06-06T07:06:00.000
| 4 | 0 | false | 6,248,772 | 0 | 0 | 1 | 2 |
As the title states, I'm trying to figure out the best practice for where to store application files for a Python website on the server. Document root, or no?
I come from a land of PHP. :)
EDIT - To that end, links to any material describing the best practice differences between Python and PHP are hugely appreciated.
|
Pass arguments to Zope browser page
| 6,253,856 | 3 | 1 | 337 | 0 |
python,parameter-passing,zope
|
You're missing rather a lot of detail on your method. Is it a method of a class? Or standalone? Normally, self would refer to an instance of the class PyTest - which would be a subclass of BrowserView.
Then, the data you pass to the view (@@test) is retrieved from the Request object, which is available in self.request (specifically, in this case, self.request.form.data) (So, you don't specify a 'data' argument to the method).
hmmm. I don't think you want the parentheses around the dict in: data: ({data: "mydata"}).
| 0 | 0 | 0 | 0 |
2011-06-06T14:29:00.000
| 1 | 1.2 | true | 6,253,541 | 0 | 0 | 1 | 1 |
In my Zope instance, I have a Python script registered as a browser page. I have the following code as its registry:
<browser:page name="test" for="*" permission="zope2.Public" class="browser.test.PyTest" attribute="CallPy" />
This function, "PyTest.CallPy" is defined as:
def CallPy(self, data): ...
I then use JavaScript to call the function, passing data in:
$.ajax({ url: "@@test", data: ({data: "mydata"}), dataType: "text", success: ..., error: ... });
However, when I make this call, I get an error that says "CallPy() takes exactly 2 arguments (1 given)".
How do I register this function as a page that passes in this data when it is called?
|
How to display the current year in a Django template?
| 6,602,387 | 50 | 182 | 64,035 | 0 |
python,django
|
{% now 'Y' %} is the correct syntax
| 0 | 0 | 0 | 0 |
2011-06-07T01:23:00.000
| 5 | 1 | false | 6,259,775 | 0 | 0 | 1 | 1 |
What is the inbuilt template tag to display the present year dynamically. Like "2011" what would be the template tag to display that?
|
Is it possible to code search engine in beautiful Soup
| 6,260,471 | 1 | 0 | 262 | 0 |
python,linux,search,beautifulsoup
|
No, BeautifulSoup is not a search engine. It is also not a Swiss Army knife, nor can it make you a sandwich. You will need a database (preferably one that's optimized for search, like Sphinx or Lucene) to do that.
| 0 | 0 | 1 | 0 |
2011-06-07T03:17:00.000
| 1 | 1.2 | true | 6,260,277 | 0 | 0 | 1 | 1 |
I am using Beautiful Soup for parsing web pages.
Are there any functions in BS which i can use i making search engine or crawling the website to index it in database.
|
How to detect online users in a web application in Google App Engine
| 6,264,539 | 2 | 2 | 548 | 0 |
python,google-app-engine,session
|
HTTP is stateless, so there's no inherent definition of "online user". You could count the number of non-destroyed sessions you've created, but unless you've got a cron job that destroys old sessions, this won't give an accurate picture.
You basically need to decide how much time without a new page request counts as "online" and query for the sessions that have been updated in that range of time.
| 0 | 1 | 0 | 0 |
2011-06-07T08:35:00.000
| 2 | 0.197375 | false | 6,262,601 | 0 | 0 | 1 | 1 |
I am currently working on an application for Google App Engine, and I need some advice to detect the number of online users in the application. How can I do this?
I am using a session library. Do I need to overwrite the session methods (create_session, destroy_session increment/and decrement a value in datastore) or is there another method that I can use?
|
Could not scrape data in English, help!
| 6,268,759 | 2 | 0 | 98 | 0 |
python,beautifulsoup
|
You haven't said what the site is so impossible to answer for sure. But a couple of suggestions. If the url does not change when you click the flag, then either:
a) The english is already in the html document, and the relevant content is being switched with javascript
b) The english content is being fetched via an ajax request and javascript is being used to edit the DOM
c) The page fully reloads with english content.
Presumably in all these cases the language preference must be stored either server-side in the session or client-side with cookies.
First tests are try turning off cookies and javascript to see what happens. Then with cookies, js back on use Firebug or Firefox to view network requests being made.
| 0 | 0 | 0 | 0 |
2011-06-07T16:36:00.000
| 2 | 0.197375 | false | 6,268,580 | 0 | 0 | 1 | 1 |
I have a website that I'm trying to scrape using Python & BeautifulSoup. The site itself can be viewed in 2 languages(Thai or English); all you have to do is to click on either the Thai or UK flag on the upper right corner of the screen and the data is displayed in the selected language. When in comes to the script though, I can only scrape the data in Thai (which is the default language) and I couldn't figure out how to get the data in English because the URL doesn't change when you click on either the Thai or UK flag. Looking at the source for the page, there are no href associated with either flag. I turned on Firebug tracing and tried to search for something to give me a clue but haven't found anything (then again you'd have to know exactly what to look for in order to know what's going on and that's my problem).
Thanks,
Glenn
|
Can I use MonkeyRunner tool to work in mobile as application
| 6,278,753 | 1 | 0 | 1,492 | 0 |
android,python,monkeyrunner
|
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner?
From your development machine, yes. Per your question title, you cannot use MonkeyRunner on a device.
Also, I have the impression that it only works with SDK?
Yes.
I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
Fortunately, no, as this would be a massive security hole.
| 1 | 0 | 0 | 0 |
2011-06-08T07:02:00.000
| 3 | 0.066568 | false | 6,275,277 | 0 | 0 | 1 | 1 |
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner? Also, I have the impression that it only works with SDK?
I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
If yes, please provide me help on how to start writing python for mobile, and how to make project for android in Python. I have used Eclipse for java for android, but not for python.
|
Are there any techniques to separate code and markup in WordPress?
| 6,283,414 | 0 | 3 | 770 | 0 |
php,python,model-view-controller,wordpress
|
I find putting all reusable template items as separate php, and including presentation logic as a theme function/object and business logic in a plugin in an okay way to separate concerns as such objects/functions are always available if loaded correctly. The template parts do save significant time if you use particular code all the time (like breadcrumbs for example).
I know its not satisfactory, but separation of concerns is possible.
| 0 | 0 | 0 | 0 |
2011-06-08T14:10:00.000
| 4 | 0 | false | 6,280,067 | 0 | 0 | 1 | 2 |
I generally work with Python to create web apps and love how I can work separately with the code and presentation layers. I really like working with Jinja2. But, I sometimes have to work with WordPress for my clients. So, I wonder, if there are any ways to make developing for WordPress a less headache with all its header.php, index.php and footer.php as well as all other pieces that may join together well or may not. Are there any suggestions to make it more convenient?
|
Are there any techniques to separate code and markup in WordPress?
| 6,280,300 | 3 | 3 | 770 | 0 |
php,python,model-view-controller,wordpress
|
Agreed with Denis, Wordpress simply is spaghetti, and there's nothing you can do about that. Nonetheless, if you're writing your own code for Wordpress (we make themes and plugins for our customers), there's nothing stopping you from splitting the concerns out into different files, and we found that it's much easier to maintain that way. You'll still have to coop with situations where Wordpress expects vanilla PHP files, but at least our code looks decent ;)
| 0 | 0 | 0 | 0 |
2011-06-08T14:10:00.000
| 4 | 1.2 | true | 6,280,067 | 0 | 0 | 1 | 2 |
I generally work with Python to create web apps and love how I can work separately with the code and presentation layers. I really like working with Jinja2. But, I sometimes have to work with WordPress for my clients. So, I wonder, if there are any ways to make developing for WordPress a less headache with all its header.php, index.php and footer.php as well as all other pieces that may join together well or may not. Are there any suggestions to make it more convenient?
|
Controlling size of swf file posted to wall using graph api
| 6,337,169 | 0 | 2 | 570 | 0 |
php,python,facebook,facebook-graph-api
|
The answer was to use the still not completely deprecated REST api, which has that functionality.
| 0 | 0 | 1 | 0 |
2011-06-08T23:23:00.000
| 2 | 1.2 | true | 6,286,449 | 0 | 0 | 1 | 2 |
I am trying to use the Facebook graph api to publish a swf file on my wall, and was wondering if there is anyway I can control the height of the swf file. It looks like facebook sets the height to 259px automatically. Any help would be really appreciated!
Thanks.
|
Controlling size of swf file posted to wall using graph api
| 6,292,361 | 1 | 2 | 570 | 0 |
php,python,facebook,facebook-graph-api
|
Facebook will automatically set the size to width:398px;height:259px.
The movie will be stretched to accomodate this.
If your movie is a different size, the best thing to do is to make sure it is at least the same aspect ratio.
| 0 | 0 | 1 | 0 |
2011-06-08T23:23:00.000
| 2 | 0.099668 | false | 6,286,449 | 0 | 0 | 1 | 2 |
I am trying to use the Facebook graph api to publish a swf file on my wall, and was wondering if there is anyway I can control the height of the swf file. It looks like facebook sets the height to 259px automatically. Any help would be really appreciated!
Thanks.
|
Django: class views, generic views, etc
| 6,286,985 | 4 | 5 | 743 | 0 |
python,django
|
There are in my opinion two cases for necessity of class-based(-generic)-views:
You really need generic functionality in your views and a little bit extra.
You write a resusable Django app and want to make it possible that others can extend your views.
For anything else use what you feel most comfortable with. As you said you basically good to go with extending from TemplateView and overwriting respective methods, though you could also use a function-based approach (and have to deal with render template calls by yourself). That's up to you in the end.
EDIT: One other advantage of class based views is that it lets you separate your code according to the request.method in a more cleaner manner and even returns 405 Method Not Allowed response codes when the wrong method is used. So you don't have to deal with lines like if request.method=='POST' or if request.method=='GET' at all and just extend a post or get method.
| 0 | 0 | 0 | 0 |
2011-06-09T00:30:00.000
| 2 | 1.2 | true | 6,286,826 | 0 | 0 | 1 | 1 |
I'm coming back to Django after a brief encounter with version 1.2, and now in version 1.3 the favored approach to views seems to be using classes.
Keeping in mind code style, maintainability and modularity: when should I use classes, and when functions? Should I always extend from generic class views (there seems to be no harm in using TemplateView), or should I use my own view callable objects?
Thanks in advance.
|
Implement time-based quotas in python
| 6,286,944 | 1 | 2 | 232 | 0 |
python,quota
|
I'm not aware of any ready-made component, but it should be fairly simple to do this.
I would probably use a database table, containing two columns: user ID and timestamp. Each time a user (IP address?) wants a connection, you find all the entries with that user ID with a timestamp between now and 60 seconds ago. If it's under the limit, you add an entry and allow the connection; otherwise, you reject the connection.
| 0 | 1 | 0 | 0 |
2011-06-09T00:31:00.000
| 1 | 1.2 | true | 6,286,838 | 0 | 0 | 1 | 1 |
I need to implement a time-based quota in my python (twisted) application.
Is there an existing module, or other implementation that I should use as a reference?
Specifically, my application needs to ratelimit connections from clients, using rules like '10 connections per minute'.
There is a Google App Engine module name 'taskqueue' that seems to fit my needs, but I am not using GAE.
Thank you.
EDIT:
platform is linux
re: iptables; it needs to be in the application b/.c the quotas will not be based on source IP address, rather some application-specific data ('clientid', for example).
|
HTML Table -- Putting a Link in the Header for Sorting? (No JavaScript)
| 6,297,204 | 0 | 2 | 5,055 | 0 |
python,html,django,hyperlink
|
You would have to grab the 'sort' variable in your server-side code and resend the query to the data source so your table would be populated in the desired manner.
In order to add the link, you would want to dynamically generate the href so it would append the sort=columnnamehere to the query string.
If you need help crafting the server-side code, please include more details about your set up (scripting language, data source, etc).
Good luck!
| 0 | 0 | 0 | 0 |
2011-06-09T17:56:00.000
| 2 | 0 | false | 6,297,149 | 0 | 0 | 1 | 1 |
I'm dynamically generating a table, as well as the column headers.
How do I make the columns clickable (NO JavaScript!), so that when they're clicked, they add a sort=columnNameHere entry to the query, and reload the current page with that query?
|
html post form different destinations
| 6,298,838 | 0 | 2 | 2,961 | 0 |
javascript,python,html,django,http-post
|
You can't. There is no way to send a form to two ressources.
What you CAN do is send a HTTP request in your register script to the newsletter script, e.g. using urllib2.
| 0 | 0 | 0 | 0 |
2011-06-09T20:25:00.000
| 5 | 0 | false | 6,298,813 | 0 | 0 | 1 | 1 |
I am developing a django web app in which I would like to have a registration process. In this registration process I have of course a form asking for name, email and password. What I would like to do is, send the form via post to 2 different places. One of which is of course the registration database which saves the password and the like, and the other being the Emencia newsletter app. In the case it helps, Emencia only needs email and a name (optional).
So how can I do this with only one form, 2 places to send it to and, taking just some of the data of the form and not all?
Thank you!
|
"Best" way to integrate Django with an Ajax library
| 6,309,310 | 1 | 8 | 4,724 | 0 |
jquery,python,ajax,django,json
|
Dajax is quite straight forward. You'd better tell us more about what puzzles you in Dajax.
| 0 | 0 | 0 | 0 |
2011-06-10T14:45:00.000
| 5 | 0.039979 | false | 6,307,992 | 0 | 0 | 1 | 2 |
Obviously, horses for courses, but what are some good ways to integrate javascript libraries with one's Django application?
I'm planning on using jQuery, mostly because it seems popular and looks powerful (but I'm open to other suggestions).
Are there python-side libraries that are very helpful or essential? Or is it best simply to create JSON views, and hand-code the javascript (using an appropriate javascript framework)?
I've looked (briefly) at Dajax, but based on the scant documentation, it's not clear that it really gives me very much. I would certainly prefer something with a bit more documentation.
Other answers here suggest that pjax doesn't necessarily work well with many browsers, so that's out.
Edit: Thanks everyone. I'll be looking at tastypie to simplify exposing some json views, and man up to write some javascript by hand (Which having done a tiny bit earlier this year, seems much better than it was in the late 90s).
|
"Best" way to integrate Django with an Ajax library
| 6,308,115 | 5 | 8 | 4,724 | 0 |
jquery,python,ajax,django,json
|
I would suggest that you simply create your own javascript and AJAX views. Ruby on Rails long had the opposite problem: forcing people to do AJAX in a certain way, and it was always a point of conflict for people. Recently, they finally realized their folly and decoupled AJAX from the framework so you can easily use whatever library you like.
This is a feature of Django. It may seem more difficult, but trust me, it ends up being infinitely better having control end-to-end.
| 0 | 0 | 0 | 0 |
2011-06-10T14:45:00.000
| 5 | 0.197375 | false | 6,307,992 | 0 | 0 | 1 | 2 |
Obviously, horses for courses, but what are some good ways to integrate javascript libraries with one's Django application?
I'm planning on using jQuery, mostly because it seems popular and looks powerful (but I'm open to other suggestions).
Are there python-side libraries that are very helpful or essential? Or is it best simply to create JSON views, and hand-code the javascript (using an appropriate javascript framework)?
I've looked (briefly) at Dajax, but based on the scant documentation, it's not clear that it really gives me very much. I would certainly prefer something with a bit more documentation.
Other answers here suggest that pjax doesn't necessarily work well with many browsers, so that's out.
Edit: Thanks everyone. I'll be looking at tastypie to simplify exposing some json views, and man up to write some javascript by hand (Which having done a tiny bit earlier this year, seems much better than it was in the late 90s).
|
Installing a my Django app on ec2
| 6,311,394 | 0 | 1 | 618 | 0 |
python,django,amazon-ec2,amazon-web-services,cloud-hosting
|
I usually simply scp -R my whole site directory into /home/bitnami of my AMI. I'm using Apache/NGINX/Django with mod_wsgi. So the directory (for example /home/bitnami/djangosites/) gets referred to based on my mod_wsgi path in my apache cfg file.
In other words, why not just move the whole directory recursively (scp -R) instead of making a tarball etc?
| 0 | 0 | 0 | 1 |
2011-06-10T18:34:00.000
| 3 | 0 | false | 6,310,624 | 0 | 0 | 1 | 1 |
Im in the process of launching a Django app on ec2, but have hit a wall trying to install my code on my AMI instance. This is my situation: I have a bitnami AMI up and running that has Django, apache, Postgresql, and nearly all my dependancies pre installed, and I have my fully functional Django app running on my local machine that I have been testing thus far with the Django Dev server. After quite a bit of googling, the most common methods of installing an app to an ec2 instance seem either using ssh/sftp/scp to drop a tarball in the instance, or creating a repository and importing code from there. If anyone can tell me the method they prefer, and guide me through the process, or provide a link to a good tutorial, it would be hugely appreciated!
|
What are my options for MVC, GUI + Interactive Visualization in App Engine (python)?
| 6,314,144 | 1 | 2 | 658 | 0 |
python,django,google-app-engine,user-interface,visualization
|
Does it have to be in python? The GAE has wonderful support for GWT. The GWT eclipse plugin can compile and deploy directly to the GAE with no further modification. The best solution that meets all three of your requirements will be to use GWT + GAE/J.
If you're mainly looking for a charting/graphing solution, there are some good solutions based on Flash *gasp* that are pretty easy to use, such as AnyChart.
As a side note, If you're designing any UI, knowing and understanding the MVC pattern is essential. Most other UI design patterns are a derivative of MVC, so you'll probably be learning MVC regardless of what framework you choose.
Good luck
-tjw
| 0 | 0 | 0 | 0 |
2011-06-11T04:06:00.000
| 3 | 0.066568 | false | 6,313,982 | 0 | 0 | 1 | 2 |
I'm creating an app that allows users to query, manipulate, and explore a very large graph.
What's the 'best' way to create a gui + visualization for my project?
By best I mean the following:
1. conforms to web standards, no flavor of the month solution
2. allows creative flexibility
3. intuitive, won't require weeks to learn and months to master
Should I start diving into Django and learning how its MVC works? Everything I've read pisses on Django, but seems like the most used option for GAE.
I'm sorry if this isn't coherent. These technologies are out of my comfort zone, so I have trouble searching for solutions and phrasing my questions.
|
What are my options for MVC, GUI + Interactive Visualization in App Engine (python)?
| 6,314,329 | 4 | 2 | 658 | 0 |
python,django,google-app-engine,user-interface,visualization
|
App Engine is flexible on the UI side. The Python supports Django templates (0.96 out of the box, and 1.2 with a one-line config change). Django templates are easy to use, and are JavaScript toolkit neutral. I use jQuery, but that's a personal choice that App Engine doesn't impose. On the UI side, it's a safe choice, and any time you put in to learning the Django template language and jQuery is portable beyond App Engine. I don't see a lot of pissing on Django, but maybe I'm hanging out in different places.
Though you emphasize the UI side, I'd look first at how to map your large graph on to the App Engine datastore, and how the queries against your graph will perform. The nuances of the App Engine datastore often trip up people who have a lot of relational experience and expect tables and real foreign keys. It's well-suited for storing graphs, but it's worth exploring and prototyping your queries, so that you know what you're getting in to.
The App Engine SDK is great for local (e.g., laptop in a coffee shop) development.
I'm a bit biased, though.
| 0 | 0 | 0 | 0 |
2011-06-11T04:06:00.000
| 3 | 1.2 | true | 6,313,982 | 0 | 0 | 1 | 2 |
I'm creating an app that allows users to query, manipulate, and explore a very large graph.
What's the 'best' way to create a gui + visualization for my project?
By best I mean the following:
1. conforms to web standards, no flavor of the month solution
2. allows creative flexibility
3. intuitive, won't require weeks to learn and months to master
Should I start diving into Django and learning how its MVC works? Everything I've read pisses on Django, but seems like the most used option for GAE.
I'm sorry if this isn't coherent. These technologies are out of my comfort zone, so I have trouble searching for solutions and phrasing my questions.
|
Django + js Framework
| 6,321,230 | 3 | 2 | 2,131 | 0 |
javascript,python,django,frameworks
|
If you already have experience with jQuery, then go on with jQuery!
I use Django + jQuery + Postgresql for all my projects and couldn't be any happier with this powerful combination.
| 0 | 0 | 0 | 0 |
2011-06-11T07:37:00.000
| 3 | 0.197375 | false | 6,314,746 | 0 | 0 | 1 | 2 |
I want to develop a web application using Django, but I can't decide which javascript framework to use. May be some of you guys has developed Django + JS Framework application? I personally prefer JQuery because it is easy and fast, but other libraries like Dojo has so cool features and widgets. That I want to switch to it! What do you guys think? Thanks in advance!
|
Django + js Framework
| 6,314,809 | 2 | 2 | 2,131 | 0 |
javascript,python,django,frameworks
|
jQuery and Scriptaculous are good choices,
But if you want to develop desktop like functionality over the web Qooxdoo helps alot :-)
| 0 | 0 | 0 | 0 |
2011-06-11T07:37:00.000
| 3 | 0.132549 | false | 6,314,746 | 0 | 0 | 1 | 2 |
I want to develop a web application using Django, but I can't decide which javascript framework to use. May be some of you guys has developed Django + JS Framework application? I personally prefer JQuery because it is easy and fast, but other libraries like Dojo has so cool features and widgets. That I want to switch to it! What do you guys think? Thanks in advance!
|
Deploying Django project on EC2 with BitNami image
| 6,315,809 | 3 | 2 | 488 | 0 |
python,django,deployment,amazon-ec2,amazon-web-services
|
The answer is pretty obvious. If you start with the Bitnami stack you'll save yourself the hassle of installing and configuring the various components (web server, gateway, python and the required libs, DB, etc.).
So if you app is pretty straight forward (typical web app) then sure, start with the bitnami stack. At most you'll reconfigure certain parts later on, as needed.
There's no particular joy in installing and configuring it all yourself, imo.
| 0 | 1 | 0 | 0 |
2011-06-11T11:35:00.000
| 1 | 0.53705 | false | 6,315,654 | 0 | 0 | 1 | 1 |
I have a complex university project that requires building some specific libraries and the use of threads (AppEngine out of the question), and I want to deploy in on EC2 (Free tier deal).
I was wondering what would be best, to start with a bare linux distribution or the BitNami Django stack ?
I've seen similar questions here, but I'm looking for Pro's and Con's mainly.
|
Apache + mod_wsgi / Lighttpd + wsgi - am I going to see differences in performance?
| 6,319,726 | 1 | 3 | 2,472 | 0 |
python,apache,lighttpd
|
That you have mentioned gevent is important. Does that mean you are specifically trying to implement a long polling application? If you are and that functionality is the bulk of the application, then you will need to put your gevent server behind a front end web server that is implemented using async techniques rather that processes/threading model. Lighttd is an async server and fits that bill whereas Apache isn't. So use of Apache isn't good as front end proxy for long polling application. If that is the criteria though, would actually suggest you use nginx rather than Lighttpd.
Now if you are not doing long polling or anything else that needs high concurrency for long running requests, then you aren't necessarily going to gain too much by using gevent, especially if intention is to use a WSGI layer on top. For WSGI applications, ultimately the performance difference between different servers is minimal because your application is unlikely to be a hello world program that the benchmarks all use. The real bottlenecks are not the server but your application code, database, external callouts, lack of caching etc etc. In light of that, you should just use whatever WSGI hosting mechanism you find easier to use initially and when you properly work out what the hosting requirements are for your application, based on having an actual real application to test, then you can switch to something more appropriate if necessary.
In summary, you are just wasting your time trying to prematurely optimize by trying to find what may be the theoretically best server when in practice your application is what you should be concentrating on initially. After that, you also should be looking at application monitoring tools, because without monitoring tools how are you even going to determine if one hosting solution is better than another.
| 0 | 0 | 0 | 1 |
2011-06-12T01:31:00.000
| 2 | 0.099668 | false | 6,319,575 | 0 | 0 | 1 | 2 |
I'm a newbie to developing with Python and I'm piecing together the information I need to make intelligent choices in two other open questions. (This isn't a duplicate.)
I'm not developing using a framework but building a web app from scratch using the gevent library. As far as front-end web servers go, it seems I have three choices: nginx, apache, and lighttpd.
From all accounts that I've read, nginx's mod_wsgi isn't suitable.
That leaves two choices - lighttpd and Apache. Under heavy load, am I going to see major differences in performance and memory consumption characteristics? I'm under the impression Apache tends to be memory hungry even when not using prefork, but I don't know how suitable lighttp is for Python apps.
Are there any caveats or benefits to using lighttpd over apache? I really want to hear all the information you can possibly bore me with!
|
Apache + mod_wsgi / Lighttpd + wsgi - am I going to see differences in performance?
| 6,319,667 | 5 | 3 | 2,472 | 0 |
python,apache,lighttpd
|
Apache...
Apache is by far the most widely used web server out there. Which is a good thing. There is so much more information on how to do stuff with it, and when something goes wrong there are a lot of people who know how to fix it. But, it is also the slowest out of the box; requring a lot of tweaking and a beefier server than Lighttpd. In your case, it will be a lot easier to get off the ground using Apache and Python. There are countless AMP packages out there, and many guides on how to setup python and make your application work. Just a quick google search will get you on your way. Under heavy load, Lighttpd will outshine Apache, but Apache is like a train. It just keeps chugging along.
Pros
Wide User Base
Universal support
A lot of plugins
Cons
Slow out of the box
Requires performance tweaking
Memory whore (No way you could get it working on a 64MB VPS)
Lighttpd...
Lighttpd is the new kid on the block. It is fast, powerful, and kicks ass performance wise (not to mention use like no memory). Out of the box, Lighttpd wipes the floor with Apache. But, not as many people know Lighttpd, so getting it to work is harder. Yes, it is the second most used webserver, but it does not have as much community support behind it. If you look here, on stackoverflow, there is this dude who keeps asking about how to get his Python app working but nobody has helped him. Under heavy load, if configured correctly, Lighttpd will out preform Apache (I did some tests a while back, and you might see a 200-300% performance increase in requests per second).
Pros
Fast out of the box
Uses very little memory
Cons
Not as much support as Apache
Sometimes just does not work
Nginx
If you were running a static website, then you would use nginx. you are correct in saying nginx's mod_wsgi isn't suitable.
Conclusion
Benefits? There are both web servers; designed to be able to replace one another. If both web servers are tuned correctly and you have ample hardware, then there is no real benefit of using one over another. You should try and see which web server meets your need, but asking me; I would say go with Lighttpd. It is, in my opinion, easier to configure and just works.
Also, You should look at Cherokee Web Server. Mad easy to set up and, the performance aint half bad. And you should ask this on Server Fault as well.
| 0 | 0 | 0 | 1 |
2011-06-12T01:31:00.000
| 2 | 1.2 | true | 6,319,575 | 0 | 0 | 1 | 2 |
I'm a newbie to developing with Python and I'm piecing together the information I need to make intelligent choices in two other open questions. (This isn't a duplicate.)
I'm not developing using a framework but building a web app from scratch using the gevent library. As far as front-end web servers go, it seems I have three choices: nginx, apache, and lighttpd.
From all accounts that I've read, nginx's mod_wsgi isn't suitable.
That leaves two choices - lighttpd and Apache. Under heavy load, am I going to see major differences in performance and memory consumption characteristics? I'm under the impression Apache tends to be memory hungry even when not using prefork, but I don't know how suitable lighttp is for Python apps.
Are there any caveats or benefits to using lighttpd over apache? I really want to hear all the information you can possibly bore me with!
|
Choosing a Python webscraping framework for handling pure Javascript based sites
| 6,322,502 | 0 | 2 | 1,041 | 0 |
python,selenium,web-scraping,selenium-webdriver,windmill
|
Before using tools like Selenium that are designed for front end testing and not for scraping, you should have a look at where the data on the site comes from. Find out what XHR requests are made, what parameters they take and what the result is.
For example the site you mentioned in your comment does a POST request with lots of parameters in JavaScript and displays the result. You probably only need to use the result of this POST request to get your data.
| 0 | 0 | 1 | 0 |
2011-06-12T11:32:00.000
| 1 | 0 | false | 6,321,696 | 0 | 0 | 1 | 1 |
I'm a Python programmer specializing in web-scraping, I had to ask this question as I found nothing relevant.
I want to know what are the popular, well documented frameworks that are available for Python for scraping pure Javascript based sites? Currently I know Mechanize and Beautiful Soup but they do not interact with Javascript so I'm looking for something different. I would prefer something that would be as elegant and simple as mechanize.
I've done a bit of research and so far I've heard about Selenium, Selenium 2 and Windmill.
Right now I'm trying to choose among one these three and I do not know of any others.
So can anyone point out the features of these frameworks and what makes them different? I heard that Selenium uses a separate server to do all it's task and it seems to be feature rich. Also what is the core difference between Selenium and Selenium2? Please enlighten me if I'm wrong, and if you know of any other frameworks do mention it's features and other details.
Thanks.
|
E-commerce from scratch or not
| 6,325,410 | 3 | 10 | 12,769 | 0 |
php,python,django,magento,e-commerce
|
I've no experience with Django. I develop websites using Wordpress and a year ago I tested Magento (not tested it since).
I was surprised of how user friendly Magento was. Both front end and backend. It was really easy to set up. You can easily customize the layout as well using Magento template API.
Here are some pros and cons:
Pros
Don't develop your own e-commerce site. It's a lot of work to re-invent the wheel.
By using a well know e-commerce product, you will also find support.
E-commerce platforms like Magento are easy to set up and offer the option of changing the look and feel to match the rest of the web site.
You can easily combine CMS and e-commerce
E-commerce platforms like Magento offer the option for custom static / dynamic pages (like a mini cms)
You will save money (development time) by using something that is already developed
Most e-commerce sites handle payment towards different banking providers.
Cons
Magento does not work on all servers (server configuration). This however might have changed in the past year.
If free e-commerce products like Magento do not satisfy your needs, you need to buy licenses. And that costs a lot of money.
It takes a lot of time developing your own e-commerce site if you want quality and usability. There is no way you can develop a good e-commerce site from scratch in just 3 months.
| 0 | 0 | 0 | 0 |
2011-06-12T22:22:00.000
| 8 | 1.2 | true | 6,325,094 | 0 | 0 | 1 | 2 |
I need to develop a new site with the e-commerce part. I'm here to get some hints from you on which road I should go on.
The site will have a static part which include some static pages and the e-commerce part for sell the products. I'm a Django and PHP developer but this is the first time I need to develop an e-commerce.
I see there's some solutions like Satchmo for Django and Magento for PHP.
There's also some services like Shopify that provide a pre cooked solution.
These are my requirements:
I'll need to give to my site a custom layout/style, all written by me
I'll need a nice admin interface for view the incoming orders, the average orders for day and other nice stuff (I see Magento have a very nice panel for this)
I'll need a feature that reports me the products that are outgoing out of stock
Maybe I'll need to implement a custom payment method
Maybe I'll need to implement a custom shipping courier
Of course I prefer Django instead PHP. Anyone can give me an hint? I've never used anyone of this framework/products.
Thank you.
-- EDIT
Deadline is 3 months. Budget ~7500 $. I've three months for finish it.
|
E-commerce from scratch or not
| 6,325,503 | 0 | 10 | 12,769 | 0 |
php,python,django,magento,e-commerce
|
Many of us have been in the same situation before - code-from-scratch (CFS) or use a framework.
My experience - I started scripting with Perl. And one of the most used module (for web programming) of PERL is CGI. Some considered it a 'heavy' module and thus a few had developed a 'lighter' version of it. For a newbie, this could be confusing - which module to use? Browsing the archive mailing lists of Perl, I came across what I still consider a gem of a wisdom - what you don't know matters as much as what you know.
This perl guru reminded everyone that the CGI module had been reviewed by many developers. He went on to explain how the way strings was handled by C (Perl is made with C) was used by crackers to exploit web apps, but the CGI module had code to prevent such security exploits. He went on to add that NONE of the new CGI modules thats he had come aross had code to prevent this same exploit because none of them were aware about this issue!
And ofcourse, like James Black commented on your question, you need to consider the time factor too.
When selecting a framework or module:
Look at how old it is.
Look at how active it's developers are (through mailing lists archives, IRC etc).
Do the developers provide good support?
Is it secure?
Is it popular?
| 0 | 0 | 0 | 0 |
2011-06-12T22:22:00.000
| 8 | 0 | false | 6,325,094 | 0 | 0 | 1 | 2 |
I need to develop a new site with the e-commerce part. I'm here to get some hints from you on which road I should go on.
The site will have a static part which include some static pages and the e-commerce part for sell the products. I'm a Django and PHP developer but this is the first time I need to develop an e-commerce.
I see there's some solutions like Satchmo for Django and Magento for PHP.
There's also some services like Shopify that provide a pre cooked solution.
These are my requirements:
I'll need to give to my site a custom layout/style, all written by me
I'll need a nice admin interface for view the incoming orders, the average orders for day and other nice stuff (I see Magento have a very nice panel for this)
I'll need a feature that reports me the products that are outgoing out of stock
Maybe I'll need to implement a custom payment method
Maybe I'll need to implement a custom shipping courier
Of course I prefer Django instead PHP. Anyone can give me an hint? I've never used anyone of this framework/products.
Thank you.
-- EDIT
Deadline is 3 months. Budget ~7500 $. I've three months for finish it.
|
GSUtil vs PHP RESTful class
| 9,041,894 | 2 | 0 | 766 | 0 |
php,python,rest,google-cloud-storage
|
Fundamentally, your PHP code and gsutil are both using the RESTful interface (gsutil is actually layered atop an open source Python library called boto which implements the bulk of the REST interface), however, there are several reasons to consider using gsutil:
Gsutil takes care of OAuth 2.0 authentication/authorization for you.
Gsutil does wildcard expansion, which, for example would enable you to remove all objects in a bucket by specifying, simply, 'gsutil rm gs://bucket/*'
Gsutil has lots of other features (get/set ACLs and associated XML parse/build, listing bucket contents, dump object contents, etc.) which you would have to implement yourself (or find in some other PHP library) if you bypass gsutil.
Gsutil has some nice performance capabilities for your "uploading many small files" use case. In particular, the -m option runs your uploads in parallel processes and threads, which provides a substantial performance boost.
In summary, you can roll your own PHP code but I think you'll get your job done faster and have access to more functionality if you leverage gsutil.
| 0 | 0 | 0 | 1 |
2011-06-13T07:18:00.000
| 1 | 1.2 | true | 6,327,592 | 0 | 0 | 1 | 1 |
We all know that working with S3 is a pain: deleting virtual directories requires to delete all the objects from within the path, etc. At least with RESTful API this is the case.
I was wondering whether there would be any performance improvement if I would use PHP to call GSUtil rather than using my own PHP class. Is there anything special the way GSUtil handles requests or is it the same REST wrapper?
The main issues I am having:
deleting big folders
uploading many small files
reading hierarchical data steps (e.g. only files and folders under /foo path, but not their children-children)
|
Can I generate html templates from models
| 6,328,303 | 1 | 2 | 131 | 0 |
python,django
|
For a list page, you could just generate a table.
For an add/edit page, use Django Forms.
| 0 | 0 | 0 | 0 |
2011-06-13T08:43:00.000
| 2 | 0.099668 | false | 6,328,289 | 0 | 0 | 1 | 1 |
I know we can generate Database Tables from models, which enables a fast development.
Can we also generate HTML templates from models, such as list/add/edit?
You know we can do this in Grails. Hopefully we can also do that in Django.
|
limits of bulk email in GAE
| 6,337,957 | 2 | 1 | 196 | 0 |
python,google-app-engine,email,backend,task-queue
|
Enqueue a single task which sends emails sequentially, checking the wallclock time after each email. When the time approaches 10 minutes, chain another task to continue where the current task left off. If you want to send emails faster, parallelize this, and enqueue several tasks that each send emails to a subset of users.
| 0 | 1 | 0 | 0 |
2011-06-13T15:30:00.000
| 1 | 1.2 | true | 6,332,562 | 0 | 0 | 1 | 1 |
I'm working on a voting app where I need to send an email to each voter to inform him or her about the election. I see three methods for doing this and I'm curious what the approximate limits on the number of emails I could send with each method:
In a user request, add a task to a task queue where each task sends one email. The limit here is how many tasks I can queue up in 30 seconds. Is there a way to estimate this reliably?
In a user request, add one task to a task queue where that one task adds tasks to a second task queue where each task in the second queue sends a single email. Since the limit here is 10 minutes, is it a reasonable estimate that I can send 20 times as many emails as with method 1?
Use a backend which doesn't have a time limit so I could presumably send as many emails as I need to.
If methods 1 or 2 could send a sufficient number of emails I would prefer to stick with them to avoid the extra complexity of using a backend. If it matters, I'm using the Python API.
|
GAE expanded log view
| 6,337,910 | 1 | 0 | 96 | 0 |
python,google-app-engine,logging
|
App Engine stores logging information in a set of circular buffers. When it runs out of space, it overwrites older log entries with the new data. What you're seeing is requests for which the detailed logs have been overwritten by newer requests.
| 0 | 1 | 0 | 0 |
2011-06-13T19:24:00.000
| 1 | 1.2 | true | 6,335,248 | 0 | 0 | 1 | 1 |
This might not be bug, but feature. I'm having problem views expanded logs when searching logs in dashboard on app engine.
Search results show first couple of logs in full detail, but rest of log entries are obscured. Every new entry in log is shown in full details, but older ones get obscured over the time.
Same behavior is reflected if I try to download logs from app engine, only more log entries are not obscured.
Point is that I can't get full log of my app and would like to be able to run some tasks over data.
|
Django-Haystack with Solr contains search
| 16,082,986 | 2 | 7 | 2,893 | 0 |
python,django,solr,django-haystack
|
You can achieve the same behavior without having to touch the solr schema. In your index, make your text field an EdgeNgramField instead of a CharField. Under the hood this will generate a similar schema to what lindstromhenrik suggested.
| 0 | 0 | 0 | 0 |
2011-06-14T00:14:00.000
| 4 | 0.099668 | false | 6,337,811 | 0 | 0 | 1 | 2 |
I am using haystack within a project using solr as the backend. I want to be able to perform a contains search, similar to the Django .filter(something__contains="...")
The __startswith option does not suit our needs as it, as the name suggests, looks for words that start with the string.
I tried to use something like *keyword* but Solr does not allow the * to be used as the first character
Thanks.
|
Django-Haystack with Solr contains search
| 14,520,797 | 0 | 7 | 2,893 | 0 |
python,django,solr,django-haystack
|
I am using an expression like:
.filter(something__startswith='...')
.filter_or(name=''+s'...')
as is seems solr does not like expression like '...*', but combined with or will do
| 0 | 0 | 0 | 0 |
2011-06-14T00:14:00.000
| 4 | 0 | false | 6,337,811 | 0 | 0 | 1 | 2 |
I am using haystack within a project using solr as the backend. I want to be able to perform a contains search, similar to the Django .filter(something__contains="...")
The __startswith option does not suit our needs as it, as the name suggests, looks for words that start with the string.
I tried to use something like *keyword* but Solr does not allow the * to be used as the first character
Thanks.
|
Link within flash file posted on facebook wall possible?
| 6,349,413 | 0 | 1 | 262 | 0 |
python,flash,facebook,facebook-graph-api
|
I suppose so... just set a click event handler inside the Flash movie to redirect the user to wherever you want.
| 0 | 0 | 1 | 0 |
2011-06-14T05:42:00.000
| 2 | 1.2 | true | 6,339,541 | 0 | 0 | 1 | 2 |
Is there anyway I can add a link to a flash file I post on my wall using the rest/graph api, such that when a user clicks on the flash file playing, it takes them to my app?
Thanks.
|
Link within flash file posted on facebook wall possible?
| 15,536,720 | 1 | 1 | 262 | 0 |
python,flash,facebook,facebook-graph-api
|
I don't know if you still require this , But here is the solution to what you are seeking:
Use the Feed dialog , and specify in the link parameter the URL of your APP , and in the source parameter , the URL of the flash file you want to post.
| 0 | 0 | 1 | 0 |
2011-06-14T05:42:00.000
| 2 | 0.099668 | false | 6,339,541 | 0 | 0 | 1 | 2 |
Is there anyway I can add a link to a flash file I post on my wall using the rest/graph api, such that when a user clicks on the flash file playing, it takes them to my app?
Thanks.
|
Connecting C# Back-end with PHP frontend
| 6,341,033 | 1 | 4 | 3,827 | 0 |
c#,php,asp.net,python,web-services
|
You can do whatever you like. Personally i wouldnt use php because i dont know very much php.
But you can do it, you could expose a soap web service and there are libraries that will let php talk to it.
No one here will be able to tell you what you haven't already told us. Asp.Net will probably be easier because of how everything integrates and you can share classes etc - but that does not mean you HAVE to use it.
Both of them are fairly passive server side technologies that present html to browsers though. why do you need 2 servers?
You have to ask why you are doing it .. if you are playing and want to learn then of course you can do it just to see how it all works. But if you are on a commercial project then id suggest that you dont need both a php and a c# server ... or if you do perhaps you want to go asp.net for your web server and if you need another layer of services behind then use WCF if you want to go a microsoft route. Howver it is usually possible to host all services in the same IIs instance.
| 0 | 0 | 0 | 1 |
2011-06-14T08:28:00.000
| 4 | 0.049958 | false | 6,340,972 | 1 | 0 | 1 | 3 |
I have a code written in C# I would like to use as the back-end of a site I'm building.
I would prefer not to build the site front-end in ASP.NET (which integrates nicely with C#), and to use PHP or Python instead.
Is that reasonable? Should I re-consider using ASP.NET?
How can I achieve that?
|
Connecting C# Back-end with PHP frontend
| 43,901,958 | 0 | 4 | 3,827 | 0 |
c#,php,asp.net,python,web-services
|
Ugh, in normal instances, reading data with C# writing it to files and loading up with PHP sound slow, inefficient and down wright crazy. I believe these terms are being used wrongly.
Client Server - user machine - database great for private networks where you connect to the DB without going over the internet
vs n-Tier
Client - Browser programming html, css, javascript connects to middleware over the internet
Middleware - inside your firewall, connects browser to database could be called part of backend - php and C# are middleware languages
Database final (generally 3rd) tier
With php and c# you are creating multiple middleware layers
why why why would you do this for a web app pick one
now if you have a web app with PHP and sneakerware in house client server apps that are controlled ie shipping, accounting that are not exposed - maybe but you have added complexity that you would not need (generally)
Gary
| 0 | 0 | 0 | 1 |
2011-06-14T08:28:00.000
| 4 | 0 | false | 6,340,972 | 1 | 0 | 1 | 3 |
I have a code written in C# I would like to use as the back-end of a site I'm building.
I would prefer not to build the site front-end in ASP.NET (which integrates nicely with C#), and to use PHP or Python instead.
Is that reasonable? Should I re-consider using ASP.NET?
How can I achieve that?
|
Connecting C# Back-end with PHP frontend
| 6,341,059 | 3 | 4 | 3,827 | 0 |
c#,php,asp.net,python,web-services
|
Just use asp.net mvc framework for the frontend instead of plain asp.net. It's easy to learn. And if you know php it will be easy to you undestand asp.net mvc.
I don't see the reasons if you are using c# backend use php frontend. For sure you can create service layer on c# and communicate with php through it, but it does not make sence for me.
| 0 | 0 | 0 | 1 |
2011-06-14T08:28:00.000
| 4 | 0.148885 | false | 6,340,972 | 1 | 0 | 1 | 3 |
I have a code written in C# I would like to use as the back-end of a site I'm building.
I would prefer not to build the site front-end in ASP.NET (which integrates nicely with C#), and to use PHP or Python instead.
Is that reasonable? Should I re-consider using ASP.NET?
How can I achieve that?
|
Adding custom button or a tag to django admin
| 7,200,879 | 0 | 0 | 1,283 | 0 |
python,django-admin
|
I used Omokoli's solution from above but to make the field use my custom widget I did:
class MyModelAdminForm(forms.ModelForm):
class Meta:
model = get_model('myapp', 'mymodel')
widgets = {
'original_link': OutputWidget,
}
| 0 | 0 | 0 | 0 |
2011-06-14T10:27:00.000
| 4 | 0 | false | 6,342,183 | 0 | 0 | 1 | 1 |
I want to add some html element (button, "a" tag, etc ) to a django admin page. How can i do it? Please help.
|
Is there a standard DSL for data integrity validation?
| 6,509,510 | 1 | 3 | 976 | 0 |
java,python,validation,import-from-csv
|
Can you imagine a DSL that would do it? How will the rules look like?
Several months ago I worked on such problem - in the end it turned out to be harder than it seemed first.
The first step was obvious - all
rows were parsed and placed to the
special data stuctures so I could
work with them; the ones with
missing fields were thrown out.
Every row had its current "strategy"
property, and a list of possible
strategies (Default action, Ignore,
Force, Overwrite etc.)
At first all rows had their "strategy"
property set to "Default".
Row processor checked that operation was
possible, creating list of errors
and warnings.
After processing
and analyzing results every row that
caused problems was given a list of
alternate strategies the user could
choose;
So, if there were any problems, user could change the row strategy (or just simply use "Ignore") and go back to step 4.
So, I'm curious at what step would such a DSL work?
| 0 | 0 | 0 | 0 |
2011-06-14T17:12:00.000
| 1 | 0.197375 | false | 6,347,374 | 0 | 0 | 1 | 1 |
I am faced with CSV files which come from clients and which can contain hundreds of thousands of rows. Is there a DSL (or wildly popular library in Java or Python) which can efficiently run calculations on this information, applying various rules to issue warnings and errors (user-configurable, of course)?
|
pyramid: get application absolute url
| 6,360,651 | 4 | 5 | 2,905 | 0 |
python,pylons,pyramid
|
Pyramid (like most WSGI applications) can be mounted on any domain and url prefix. Thus the application itself doesn't actually know what urls it is responsible for unless you code that into your application specifically (an INI setting, for example).
This is why request.application_url exists... because the application_url could be different per request based on how many different domains and url prefixes you have that are proxying requests to your application.
| 0 | 0 | 0 | 0 |
2011-06-14T18:15:00.000
| 2 | 1.2 | true | 6,348,094 | 0 | 0 | 1 | 1 |
Is there any way to get pyramid absolute application url in main() function?
I want to add it into global settings, so it could be called every where(in templates and js files).
In pyramid documents there is some functions would help, but all of them need a request object and must call in a view.
Thanks.
|
Turing complete template engines
| 6,351,798 | 0 | 5 | 630 | 0 |
python,ruby,perl,templates,programming-languages
|
Virtually anything that allows procedural code to compute the template result.
| 0 | 0 | 0 | 1 |
2011-06-15T00:38:00.000
| 4 | 0 | false | 6,351,765 | 0 | 0 | 1 | 1 |
What template engines / template languages are turing complete? I heard about these so far:
FreeMarker (implemented in java)
MovableTypes template language (in perl)
xslt :-(
Cheetah (in Python)
Smarty (in PHP)
Any others (especially implemented with perl)?
Ps: Don't waste time with clarifying me MVC, and why turing complete templates are bad, and why this is not a useful comparison point :)
|
Formatting strings with python in django
| 6,355,486 | 1 | 1 | 170 | 0 |
python,django,string
|
The most flexible way - is to create custom template filter. If string needs formatting, it will do that, if it doesn't - just output it.
| 0 | 0 | 0 | 0 |
2011-06-15T09:09:00.000
| 1 | 1.2 | true | 6,355,449 | 0 | 0 | 1 | 1 |
I have a question list for a questionnaire which are stored in database but some questions has to be modified by certain parameters.
For example, if someone selects an employer name from previous page, some questions should have employer's name "Do you like to work for ........ company ?".
One solution might be savinf question like "Do you like to work for {0}" and formatting it but I am not sure how I can implement it with python.
But how can I detect which questions need to be modified ?
Is there any easy way to do it in django ?
Thanks
|
Python Plone views call others
| 6,360,580 | 1 | 0 | 327 | 0 |
python,views,plone
|
Just import it and call it as any other function. You don't want to make it a view - that requires you to do a MultiAdapter lookup which is a real pain, and completely unnecessary.
[Edit - strictly using a view is a MultiAdapter lookup, but you can shortcut it via traversal, but that still isn't worth the effort]
| 0 | 0 | 0 | 1 |
2011-06-15T14:44:00.000
| 1 | 1.2 | true | 6,359,581 | 0 | 0 | 1 | 1 |
I have a Python function registered as a View in Plone. I need to be able to call another function from within this registered function. I'm not sure if it would be best to register this other function as a view as well and try to call that (don't know how to call other views), or if there is a better way to handle this.
Basically I'm creating a function in Python that needs to be callable from other Python functions (that are registered as Views).
Edit -
I have tried calling it like any other function:
(pytest.py)
def Test(self):
return "TEST"
And in my Python script registered as a view:
import pytest
def PageFunction(self):
return pytest.Test()
However, this always seems to crash. If I leave the pytest.Test() out and return a simple string, it seems to work fine (so I don't think the import pytest line is causing any problems...)
|
How do I write the Multiplication Sign in reStructuredText (reST)?
| 14,228,087 | 3 | 3 | 6,465 | 0 |
utf-8,special-characters,python-sphinx,restructuredtext
|
I would use MathML within rst :math:`m \times p`
| 0 | 0 | 0 | 0 |
2011-06-16T08:26:00.000
| 4 | 0.148885 | false | 6,369,049 | 1 | 0 | 1 | 1 |
I'm writing reST documents that will be rendered to HTML and PDF using Sphinx. My source files are UTF-8, and expect my HTML to be displayed as UTF-8.
What's the best practice for writing the multiplication sign?
That is: ×, not x.
I know I can insert it as a Unicode character. If I were writing LaTeX, I'd use \times. In HTML there's ×. Is the simple Unicode going to properly survive the conversion process when I render everything with Sphinx? Even if I render to other more exotic formats?
I just want to double-check that this isn't going to trip things up somewhere.
|
App Engine TimeOut Error: Serving a third-party API with an image stored on App Engine
| 6,373,752 | 1 | 1 | 494 | 0 |
python,image,api,google-app-engine,timeout
|
If you directly use the App Engine URLfetch API, you can adjust the timeout for your request. The default is 5 seconds, and it can be increased to 10 seconds for normal handlers, or to 10 minutes for fetches within task queue tasks or cron jobs.
If the external API is going to take more than 10 seconds to respond, probably your best bet would be to have your email handler fire off a task that calls the API with a very high timeout set (although almost certainly it would be better to fix your "pretty bad encoding problems"; how bad can encoding binary data to POST be?)
To answer your first question: if you're using dev_appserver, no, you can't handle any requests at all while you've got an external request pending; dev_appserver is single-threaded and handles 1 request at a time. The production environment should be able to scale to do this; however, if you have handlers that are waiting 10 seconds for a urlfetch, the scheduler might not scale your application well since the latency of incoming requests is one of the factors in auto-scaling.
| 0 | 1 | 0 | 0 |
2011-06-16T10:21:00.000
| 1 | 1.2 | true | 6,370,335 | 0 | 0 | 1 | 1 |
I'm building an application in Python on App Engine. My application receives images as email attachments. When an email comes in, I grab the image and need to send it to a third party API.
The first thing I did was:
1) make a POST request to the third party API with the image data
I stopped this method because I had some pretty bad encoding problems with urllib2 and a MultipartPostHandler.
The second thing I'm doing right now is
1) Put the image in the incoming email in the Datastore
2) Put it in the memcache
3) Send to the API an URL that serves the image (using the memcache or, if not found in the memcache, the Datastore)
The problem I read on my logs is: DeadlineExceededError: ApplicationError: 5
More precisely, I see two requests in my logs:
- first, the incoming email
- then, the third party API HTTP call to my image on the URL I gave him
The incoming email ends up with the DeadlineExceededError.
The third party API call to my application ends up fine, serving correctly the image.
My interpretation:
It looks like App Engine waits for a response from the third party API, then closes because of a timeout, and then serves the request made by the third party API for the image. Unfortunately, as the connection is closed, I cannot get the useful information provided by the third party API once it has received my image.
My questions:
1) Can App Engine handle a request from a host it supposes to get a response of?
2) If not, how can I bypass this problem?
|
Django create groups on init, extending superuser profile
| 6,374,988 | 6 | 4 | 2,720 | 0 |
python,django,django-syncdb
|
2 steps:
Take a dump from an existing database containing all the required data using the command dumpdata
After syncdb, load the fixture using the command loaddata
| 0 | 0 | 0 | 0 |
2011-06-16T16:00:00.000
| 3 | 1 | false | 6,374,899 | 0 | 0 | 1 | 1 |
I create a site in Django and here is my Question
How to make something like this:
On init (for example, when someone run "syncdb"?)
I need to create a group with permissions
and extend superuser profile from User to UserProfile(when user register it's not a problem but first admin/superuser is autocreated when app is created)
because, after installation you need to manually perform these operations in the admin panel.
sorry for my English, it's hard to explain to me the problem.
I hope you understand.
|
django: why does accessing a page from web browser freeze the server?
| 6,391,503 | 2 | 2 | 256 | 0 |
python,django,browser
|
The Django development server only does 1 request at a time. I believe that's why you have the issue.
| 0 | 0 | 0 | 0 |
2011-06-17T20:23:00.000
| 2 | 0.197375 | false | 6,391,388 | 0 | 0 | 1 | 1 |
I've made a django app, running it w/ the built-in server for now (just for testing). I have programs which access urls multiple times per second on the app without any issues. However, when I view an admin page, or one of those URLs that the program visits, in a web browser, the server freezes for many seconds. Why might this be the case, and how can I prevent it?
|
Installing Mechanize using easy_install
| 6,395,374 | 0 | 0 | 248 | 0 |
python,mechanize,easy-install
|
What's your Python installation location?
How did you run easy_install?
easy_install probably uses the default user account permissions and you need to manually change file permissions / ownership so that non-admins can see the files.
Generally, easy_install is designed for single user installations (development use) only. including other platforms (Linux, UNIX). If you wish to distribute application / package which works well on your operating system you need to repackage it in a format friendly for this operating system.
lxml etc. Python packages come with .EXE installer. Perhaps you could check how installer of these packages have been done and apply the same installer creation script for mechanize.
| 0 | 1 | 0 | 0 |
2011-06-18T06:26:00.000
| 1 | 1.2 | true | 6,394,305 | 0 | 0 | 1 | 1 |
I've installed mechanize using easy_install on Windows 7 Admin account. However, when I try to setup/run another program that needs mechanize on a different account, it doesn't find it.
Any solutions?
|
Fastest way to handle a submit button with a variable in it?
| 6,400,025 | 1 | 0 | 75 | 0 |
python,html,forms
|
If the POST values are stored in a dict you could turn this around and instead of looking for something that looks like a remove-# you generate all remove-# and try to use them to index the dict. That would limit the search to O(m) where m is the number of elements that can be removed.
| 0 | 0 | 0 | 0 |
2011-06-19T01:22:00.000
| 3 | 0.066568 | false | 6,399,975 | 0 | 0 | 1 | 2 |
I've got a form with a bunch of items. Beside each item is a "Remove" button. When one of buttons is pressed, I need to know which one so that I know which item to remove.
The way I have it now, each button is named remove-# where # is the index of the item. In order to grab the # though I have to loop over every POST value, check if the key starts with remove- and if it does, parse out the integer.
Is there any method that would be faster than O(n) where n is the number of post vars?
Not that n is so large that this would become an expensive operation, but mostly because I'm curious.
Also, before I get any answers that suggest I use JavaScript and put an onclick event on each button to move the index into a separate hidden input.... I'm trying to do this without JavaScript.
|
Fastest way to handle a submit button with a variable in it?
| 6,399,995 | 1 | 0 | 75 | 0 |
python,html,forms
|
An option would be to put each remove button in a separate form, with a hidden value with a constant name and the value indicating which item to remove.
| 0 | 0 | 0 | 0 |
2011-06-19T01:22:00.000
| 3 | 0.066568 | false | 6,399,975 | 0 | 0 | 1 | 2 |
I've got a form with a bunch of items. Beside each item is a "Remove" button. When one of buttons is pressed, I need to know which one so that I know which item to remove.
The way I have it now, each button is named remove-# where # is the index of the item. In order to grab the # though I have to loop over every POST value, check if the key starts with remove- and if it does, parse out the integer.
Is there any method that would be faster than O(n) where n is the number of post vars?
Not that n is so large that this would become an expensive operation, but mostly because I'm curious.
Also, before I get any answers that suggest I use JavaScript and put an onclick event on each button to move the index into a separate hidden input.... I'm trying to do this without JavaScript.
|
Java applet or a custom browser plugin?
| 6,401,478 | 1 | 0 | 550 | 0 |
java,python,applet
|
The universal API for browser addons is javascript. It is well supported in Firefox, Chromium/Chrome, and Opera at least; it is the only extension API available on the last two. Intersting API subsets are firefox's Fuel, Chromium's trimmed down extension api, and the very portable GreaseMonkey functions.
A second runtime would have its own startup costs, garbage heap, and ffi overhead. It would require special privileges, and would still have to translate its API calls into javascript. That would make it fairly unattractive.
Edit: you were asking about web content with possible plugin or addon support? You also have the option of the NPAPI (also the Pepper project around it). This api is C-level and can render to a rectangular area on its own (using OS APIs), at the cost of very little support from the browser and being a portability nightmare.
| 0 | 0 | 0 | 0 |
2011-06-19T08:44:00.000
| 1 | 0.197375 | false | 6,401,415 | 0 | 0 | 1 | 1 |
We're writing a platform for building apps that are able to run on any browser and we were thinking, is there a way to do this with Python? Or should we better go with Java and Java Applets?
I was also wondering, how hard is it to write a custom browser plugin? How long would it take e.g. in man-hours?
Thank you!
|
`Node.js` and/or other Javascript offshoots' performance, stability and speed relative to non-JS frameworks (Rails, Django...)
| 6,409,663 | 7 | 20 | 6,136 | 0 |
javascript,python,ruby-on-rails,node.js,model-view-controller
|
Node.js is beating other platforms, sure. But it's not it's raw speed (V8), it's the sophisticated event-driven model which powers the node.js platform ;)
| 0 | 0 | 0 | 0 |
2011-06-20T09:35:00.000
| 3 | 1 | false | 6,409,306 | 0 | 0 | 1 | 1 |
I find myself often needing performance & speed references for friends who still don't believe a Node.js or other Javascript-derived implementation or application can compete with those powered by Rails, Pure Ruby, .NET, Python and similar setups.
I have seen very impressive reports on this, with graphs and eyecandy, but when I need them, I can never find them.
So maybe we can use this question to build a list of viable resources for "selling" a tech person/manager on Node.js as a viable solution. Or add citable facts to the thread
Thanks in advance.
|
Google App Engine __main__ module
| 6,418,275 | 2 | 1 | 332 | 0 |
python,google-app-engine
|
each script entry in your app.yaml will be executed as a __main__ module. If you only want a single __main__ then you need to run everything through a single entry-point and map everything via a single WSGIApplication instance.
| 0 | 1 | 0 | 0 |
2011-06-20T17:53:00.000
| 1 | 1.2 | true | 6,415,316 | 0 | 0 | 1 | 1 |
I'm building a data seeder module that looks for all models using introspection and the inspect module. I index the models I found by a string looking like module.model_name because there might be more modules with the same name in different modules.
The problem is that module sometimes is indeed the right module name, but sometimes it's __main__, probably because that specific module was the first one that was called to handle a URL after an instance was started. Is there anyway I can avoid this, perhaps by forcing a specific module to always be __main__?
This problems gets worse when I have multiple instances running at once because I also get inconsistent data between instances, each having a different __main__ module.
Thanks
|
Passing session info from python to flex
| 6,418,097 | 2 | 0 | 213 | 0 |
python,django,apache-flex,pyamf
|
If your Python/DJango app uses cookies for tracking sessions; then you just have to make sure that your SWF is served off the same domain that the Python app is served from.
The Flash Player will pass the appropriate cookies to the remote server whenever it makes a call to that server. As long as your "Flash Call" exists in the same Application space on the server, it should have access to the same session variables available on the server.
If you want to validate the user has logged in before loading the SWF; just make a remote call from the SWF to the server side to validate that the session exists, and the user is appropriately logged in. Don't activate any of the controls in the app until you get confirmation from the server that the user is allowed to use the app.
| 0 | 0 | 0 | 0 |
2011-06-20T21:49:00.000
| 1 | 0.379949 | false | 6,417,986 | 0 | 0 | 1 | 1 |
I have a simple site made with python (django). User registers, inputs some basic info and it stores it to mysql. User then is able to log in with his username/password which he created...
Now i want to add a flex application which will run once the user is logged in, but i dont want the user to have to log in twice (once into django, once into flex app). For the sake of learning i just want the flex app to also load some information from the mysql database, like the users firstname or something.
So my question is how would i go about passing session information into the flex app? Any info or guidance, or opinion would be great.
|
Python replacements for RVM/Bundler/Capistrano
| 6,422,391 | 3 | 10 | 1,832 | 0 |
python,ruby,development-environment,env
|
pip is 'the' tool for Python packages, replacing easy_install. Most people are using virtualenv for multiple python environments.
| 0 | 0 | 0 | 0 |
2011-06-21T08:09:00.000
| 2 | 0.291313 | false | 6,422,189 | 1 | 0 | 1 | 2 |
I'm just moving over from Ruby/Rails development to Python/Django and i'm trying to find the best replacements for RVM/Bundler/Capistrano but it seems to be a total mess?
I've found these so far:
pythonbrew
virtualenv
envwrapper
pip
easyinstall
setuptools
For capistrano I've found Fabric which seems to fit fairly well?
I've found some articles describing how to set up virtualenv/pip/fabric but it seems everyone is moving over to pythonbrew? Which ones should i pick? Also it seems pip/virtualenv is integrated fairly well but if pythonbrew is a better choice?
|
Python replacements for RVM/Bundler/Capistrano
| 6,422,481 | 3 | 10 | 1,832 | 0 |
python,ruby,development-environment,env
|
I have used pip/virtualenv/fabric extensively and am happy with it. You can't go wrong with this choice.
I haven't used pythonbrew however, so I can't do any relative comparison.
| 0 | 0 | 0 | 0 |
2011-06-21T08:09:00.000
| 2 | 1.2 | true | 6,422,189 | 1 | 0 | 1 | 2 |
I'm just moving over from Ruby/Rails development to Python/Django and i'm trying to find the best replacements for RVM/Bundler/Capistrano but it seems to be a total mess?
I've found these so far:
pythonbrew
virtualenv
envwrapper
pip
easyinstall
setuptools
For capistrano I've found Fabric which seems to fit fairly well?
I've found some articles describing how to set up virtualenv/pip/fabric but it seems everyone is moving over to pythonbrew? Which ones should i pick? Also it seems pip/virtualenv is integrated fairly well but if pythonbrew is a better choice?
|
Decoupling Domain classes from Django Model Classes
| 6,426,206 | 4 | 15 | 2,441 | 0 |
python,django,model
|
Can you seriously envisage a possibility that you're going to just ditch the Django ORM, but keep everything else? Or that if you ditched Django totally, any of your code is still going to be applicable?
You don't complain that if you ditched Django, you'll have to rewrite all your templates. Of course you will, that's to be expected. So why is it OK for the presentation layer to be bound up with the framework, but not the persistence layer?
This sort of up-front over-analysis to be avoided. Django is a RAD tool, and is best suited to quick, iterative development. For all that, it's capable of building some powerful, long-lived applications, as plenty of large companies will testify. But it's not Java, and it's not "enterprisey", and it doesn't conform particularly well to OO principles. In the Python world, that's seen as a feature, not a bug.
| 0 | 0 | 0 | 0 |
2011-06-21T12:54:00.000
| 4 | 0.197375 | false | 6,425,535 | 0 | 0 | 1 | 4 |
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django.
I want to start implementing some of my domain entity classes which need persistence. It seems that Django would have me implement these as classes that are inherited from the Django models class in order to use the Django ORM for persistence. However, this seems like far too strong coupling between my class entities and the persistence mechanism. What happens if at some stage I want to ditch Django and use another web development framework, or just ditch Django’s ORM for an alternative? Now I have to re-write my domain entity classes from scratch.
So it would be better to implement my domain classes as standalone Python classes, encapsulating all my business logic in these, and then use some mechanism (design pattern such as bridge or adapter or ???) to delegate persistence storage of these domain classes to the Django ORM, for example through a Django model class that has been appropriately set up for this.
Does anyone have suggestion on how to go about doing this? It seems from all I have read that people simply implement their domain classes as classes inherited from the Django model class and have business logic mixed within this class. This does not seem a good idea for down line changes, maintenance, reusability etc.
|
Decoupling Domain classes from Django Model Classes
| 6,426,280 | 0 | 15 | 2,441 | 0 |
python,django,model
|
You would not have to "rewrite your models from scratch" if you wanted a different persistence mechanism. The whole point of an activerecord-style persistence system is that it imposes minimal constraints on the model classes, and acts largely transparently.
If you're really worried, abstract out any code that relies on queries into their own methods.
| 0 | 0 | 0 | 0 |
2011-06-21T12:54:00.000
| 4 | 0 | false | 6,425,535 | 0 | 0 | 1 | 4 |
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django.
I want to start implementing some of my domain entity classes which need persistence. It seems that Django would have me implement these as classes that are inherited from the Django models class in order to use the Django ORM for persistence. However, this seems like far too strong coupling between my class entities and the persistence mechanism. What happens if at some stage I want to ditch Django and use another web development framework, or just ditch Django’s ORM for an alternative? Now I have to re-write my domain entity classes from scratch.
So it would be better to implement my domain classes as standalone Python classes, encapsulating all my business logic in these, and then use some mechanism (design pattern such as bridge or adapter or ???) to delegate persistence storage of these domain classes to the Django ORM, for example through a Django model class that has been appropriately set up for this.
Does anyone have suggestion on how to go about doing this? It seems from all I have read that people simply implement their domain classes as classes inherited from the Django model class and have business logic mixed within this class. This does not seem a good idea for down line changes, maintenance, reusability etc.
|
Decoupling Domain classes from Django Model Classes
| 20,776,976 | 0 | 15 | 2,441 | 0 |
python,django,model
|
I think that there's no implemented solution for decoupling Django models and the domain classes, at least I haven't found any. In fact, the only ORM with such decoupling that I know exists only in Smalltalk world and it's called GLORP. It allows you to persist your domain model in a relational DB without having to modify domain classes. I'm currently trying to implement similar ideas to decouple from Django ORM. My motivation is that current strong coupling between DB tables and domain classes hurts software evolution badly. I'll post again if I succeed :)
| 0 | 0 | 0 | 0 |
2011-06-21T12:54:00.000
| 4 | 0 | false | 6,425,535 | 0 | 0 | 1 | 4 |
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django.
I want to start implementing some of my domain entity classes which need persistence. It seems that Django would have me implement these as classes that are inherited from the Django models class in order to use the Django ORM for persistence. However, this seems like far too strong coupling between my class entities and the persistence mechanism. What happens if at some stage I want to ditch Django and use another web development framework, or just ditch Django’s ORM for an alternative? Now I have to re-write my domain entity classes from scratch.
So it would be better to implement my domain classes as standalone Python classes, encapsulating all my business logic in these, and then use some mechanism (design pattern such as bridge or adapter or ???) to delegate persistence storage of these domain classes to the Django ORM, for example through a Django model class that has been appropriately set up for this.
Does anyone have suggestion on how to go about doing this? It seems from all I have read that people simply implement their domain classes as classes inherited from the Django model class and have business logic mixed within this class. This does not seem a good idea for down line changes, maintenance, reusability etc.
|
Decoupling Domain classes from Django Model Classes
| 6,426,080 | 3 | 15 | 2,441 | 0 |
python,django,model
|
Well, the way to go with Django is to inherit from Django's base model classes. This is the 'active record' pattern. Your django models will have all CRUD and query methods along with you business logic (if you decide to add it of course). This is seen as an anti-pattern in the java world, but the cool thing about it is that it can speed up development really really fast.
| 0 | 0 | 0 | 0 |
2011-06-21T12:54:00.000
| 4 | 0.148885 | false | 6,425,535 | 0 | 0 | 1 | 4 |
So I have completed my OO analysis and design of a web application that I am building and am now getting into implementation. Design decisions have been made to implement the system using Python and the web development framework Django.
I want to start implementing some of my domain entity classes which need persistence. It seems that Django would have me implement these as classes that are inherited from the Django models class in order to use the Django ORM for persistence. However, this seems like far too strong coupling between my class entities and the persistence mechanism. What happens if at some stage I want to ditch Django and use another web development framework, or just ditch Django’s ORM for an alternative? Now I have to re-write my domain entity classes from scratch.
So it would be better to implement my domain classes as standalone Python classes, encapsulating all my business logic in these, and then use some mechanism (design pattern such as bridge or adapter or ???) to delegate persistence storage of these domain classes to the Django ORM, for example through a Django model class that has been appropriately set up for this.
Does anyone have suggestion on how to go about doing this? It seems from all I have read that people simply implement their domain classes as classes inherited from the Django model class and have business logic mixed within this class. This does not seem a good idea for down line changes, maintenance, reusability etc.
|
Sever Side convert SVG to PNG or JPG image with Python on Google Application Engine
| 6,434,768 | -1 | 3 | 2,517 | 0 |
python,google-app-engine,svg
|
If you manage to find (or write) a pure Python library to do this, it is likely to be prohibitive to run it on GAE due to the amount of computation required and the request time restrictions.
I would consider hosting the image conversion service elsewhere and have the GAE fetch the PNGs from there
| 0 | 0 | 0 | 0 |
2011-06-22T03:17:00.000
| 2 | 1.2 | true | 6,434,530 | 0 | 0 | 1 | 1 |
How to convert SVG to PNG or JPG image with Python on Google Application Engine?
Any idea?
Google Application Engine has PIL support. However, PIL doesn't support SVG.
|
Python and Django IDE with remote editing?
| 6,714,141 | 6 | 8 | 5,204 | 0 |
python,django,ide
|
I have Pycharm setup on a Ubuntu 10.10. The key is to use "sshfs" - it maps to my web-host - via ssh. Those are the pre-reqs : ssh access, sshfs. (unless you can figure out a way to map ssh to a windows shared drive).
So once ssh, sshfs are setup, I create a linux mount locally - so my webhost's directory appears locally as "/webhostx" .. From then on Pycharm (or WingIde or any editor) does not care that "/webhostx" is really a remote folder mounted locally.
If all else fails there's always Emacs (everything included :-) ).
Pycharm also has a remote debugging feature - I am in the process of testing it with my host (webfaction).
| 0 | 0 | 0 | 1 |
2011-06-22T04:45:00.000
| 3 | 1.2 | true | 6,435,000 | 0 | 0 | 1 | 1 |
I'm looking for an IDE that will allow me to edit remote Python projects and also has decent Django support, remote command execution, and maybe remote debugging. I've tried PyCharm and Aptana with PyDev but I'm not having much luck configuring them for remote editing. Thanks for your help!
|
Why python module not found on apache
| 6,436,999 | 2 | 1 | 581 | 0 |
python,django,apache
|
HTTPd using a different version/install of Python than your REPL.
| 0 | 0 | 0 | 0 |
2011-06-22T08:26:00.000
| 1 | 1.2 | true | 6,436,979 | 0 | 0 | 1 | 1 |
I have a problem with python and Django.
I have the error "Error was: No module named httplib2", so i installed httplib2. When i go on my console and type "import httplib2" it works!
But when i try to do that on my web page, it fails.
Any idea?
Thank you!
|
Python - How to import functions?
| 6,443,008 | 0 | 2 | 1,269 | 0 |
python,syntax,import
|
You would have to import the class to get access to the instance method you've defined on the class.
| 0 | 0 | 0 | 0 |
2011-06-22T16:01:00.000
| 2 | 0 | false | 6,442,959 | 1 | 0 | 1 | 1 |
models.py
def operation(argument):
#Operation
return variable
class X(models.Model)
a = models ...
b = models ...
I am trying to import operation in my views.py .. When I try using
from project.models import operation
But then I get the following error
ImportError: cannot import name operation
|
Python function return to jQuery var
| 6,444,570 | -2 | 1 | 1,309 | 0 |
jquery,python
|
Why would you say "without using JSON"? That's exactly what JSON is for.
| 0 | 0 | 0 | 0 |
2011-06-22T18:08:00.000
| 4 | -0.099668 | false | 6,444,458 | 1 | 0 | 1 | 1 |
I've a python script that returns something. In a html page, I use jQuery to send a GET request to this script (with $.get()). I want the "return" of python script in a jQuery/javascript var. Is it possible with jQuery function? Without use JSON or other.
|
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
| 6,446,503 | 2 | 3 | 6,337 | 0 |
java,python,ruby,lamp
|
I think you're trying to read too much into what it means. The acronym became popular because they were often used together and it was easy to pronounce. It doesn't have any meaning or implication beyond the literal one. There's also WAMP (Windows), LAPP (PostgreSql) and whatever else you want to make up.
| 0 | 0 | 0 | 1 |
2011-06-22T20:50:00.000
| 4 | 0.099668 | false | 6,446,385 | 0 | 0 | 1 | 4 |
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack.
I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P.
Is a LAMP stack fundamentally different if Ruby was used? Using Ruby would typically mean using Rails, but Python web apps usually use Django or Pylons. Or does LAMP signify that no framework is used? Is Java web development essentially different because of Tomcat in place of Apache?
|
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
| 6,447,007 | 1 | 3 | 6,337 | 0 |
java,python,ruby,lamp
|
Besides being popular Web development languages, Perl, PHP, and Python share something else: They are all dynamically typed languages, and notoriously fast to develop in. I believe this is part of the "spirit" of LAMP.
So, while it's true you could substitute any other language in for the 'P', some languages fit the dynamic, agile spirit better than others. Ruby, for example, would fit very nicely. You could also use Scheme, if that's what you're good at. Java doesn't fit as nicely into LAMP because it is a statically typed language, and to many feels subjectively "heavier" than the so-called scripting languages.
| 0 | 0 | 0 | 1 |
2011-06-22T20:50:00.000
| 4 | 0.049958 | false | 6,446,385 | 0 | 0 | 1 | 4 |
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack.
I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P.
Is a LAMP stack fundamentally different if Ruby was used? Using Ruby would typically mean using Rails, but Python web apps usually use Django or Pylons. Or does LAMP signify that no framework is used? Is Java web development essentially different because of Tomcat in place of Apache?
|
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
| 6,446,413 | 8 | 3 | 6,337 | 0 |
java,python,ruby,lamp
|
It's just so happens that the most commonly used components in that part of the stack all happened to begin with a P. It's nothing more than a coincidence. The LAMP acronym was coined before Ruby gained its current popularity levels and there's no reason why you couldn't stick Ruby in the P slot.
| 0 | 0 | 0 | 1 |
2011-06-22T20:50:00.000
| 4 | 1.2 | true | 6,446,385 | 0 | 0 | 1 | 4 |
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack.
I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P.
Is a LAMP stack fundamentally different if Ruby was used? Using Ruby would typically mean using Rails, but Python web apps usually use Django or Pylons. Or does LAMP signify that no framework is used? Is Java web development essentially different because of Tomcat in place of Apache?
|
What is the significance of the 'P' in LAMP? Why is it PHP, Perl, or Python?
| 6,446,566 | 7 | 3 | 6,337 | 0 |
java,python,ruby,lamp
|
I believe the P originally stood mainly for PHP, as that particular combination was extremely widely used. It got expanded to include Python and Perl as non-PHP languages became more popular for web development, and never expanded further because it would have broken the acronym.
LAMP is a de facto standard way of doing things, but not a formal standard. Changing out the P for Ruby+Rails, or Apache/PHP for Tomcat/Java changes some things about your development process, but not other things.
One aspect of LAMP that's significant is that all the components are open-source.
| 0 | 0 | 0 | 1 |
2011-06-22T20:50:00.000
| 4 | 1 | false | 6,446,385 | 0 | 0 | 1 | 4 |
I'm a Java web developer that knows a bit of Python (but haven't done any Python web development), and I am curious what exactly is meant by a LAMP stack.
I understand this to be Linux-Apache-MySQL-(PHP, Perl, or Python), but I don't understand what unites these three languages other than the letter P.
Is a LAMP stack fundamentally different if Ruby was used? Using Ruby would typically mean using Rails, but Python web apps usually use Django or Pylons. Or does LAMP signify that no framework is used? Is Java web development essentially different because of Tomcat in place of Apache?
|
Python - from Script to Web App?
| 6,448,835 | 3 | 2 | 947 | 0 |
python,web-services,web-applications
|
Go check out Google App Engine. There's a Python API. It works well with other Google services, like Calendar. Probably the fastest way to get where you want to go.
| 0 | 0 | 1 | 0 |
2011-06-23T02:48:00.000
| 3 | 1.2 | true | 6,448,814 | 0 | 0 | 1 | 1 |
I have a Python script that can run in command line/console which works with the Google Calendar Data API to do some tasks like retrieve calendars and modify or update events. I want to turn it into a web application/interface, but was not sure what would be the optimal or simplest way going about it.
Some precursor information: I tried rewriting the application as .html files that used Javascript and its respective Google Calendar Data API. I ran into a few problems with that and found that it wasn't working as well as my Python script. It could possibly be because I am using a business gmail domain but I'm not entirely sure. It does however work fine with Python, so I've decided to stick with that.
I've only worked with Python scripts (and I'd only call myself a beginner), so I'm not sure what would be an ideal or optimal solution. I'd preferably (re: if even possible) like to have the Python script act as a backend/web-service and interface with a website through JSON, or use a Python webframework to develop it. I hope I got the bulk of my terminology right, my apologies if anything is unclear.
Any advice is appreciated, thanks!
|
idle state detection silverlight 4 application
| 9,692,923 | 2 | 6 | 1,573 | 0 |
silverlight,python-idle,dispatchertimer
|
Handled events will not bubble up to root control. Instead you should use the AddHandler method with handledEventsToo = true.
| 1 | 0 | 0 | 0 |
2011-06-23T09:25:00.000
| 2 | 0.197375 | false | 6,451,919 | 0 | 0 | 1 | 1 |
What's the best way to detect idle state for a silverlight application? I have read quite a few articles on the net by now and usually they are either for wpf/mobile apps etc.
I have created a DispatcherTimer which locks the screen after 5 minutes and it seems that I will have to go to every widget in every screen(my application has around 4-5 screens) and add a mousebuttondown or mouseenter eventhandler to reset this timer. This doesn't seem to be efficient but just adding the handler to the layroot is not helping either.
Any helpful suggestions?
Thanks
|
Making only one task run at a time in celerybeat
| 6,455,760 | 0 | 4 | 3,061 | 0 |
python,celery,celerybeat
|
You can try adding a classfield to the object that holds the function that youre making run and use that field as a "some other guy is working or not" control
| 0 | 1 | 0 | 0 |
2011-06-23T13:45:00.000
| 4 | 0 | false | 6,455,046 | 0 | 0 | 1 | 1 |
I have a task which I execute once a minute using celerybeat. It works fine. Sometimes though, the task takes a few seconds more than a minute to run because of which two instances of the task run. This leads to some race conditions that mess things up.
I can (and probably should) fix my task to work properly but I wanted to know if celery has any builtin ways to ensure this. My cursory Google searches and RTFMs yielded no results.
|
django templates performance
| 6,457,582 | 3 | 4 | 673 | 0 |
python,django,performance,django-templates
|
This is like the argument about the most efficient way to append strings (virtually every programming language has that argument). This is 2011, not 1970. Even consumer level computers have processing power and memory reserves to match the supercomputers of the last decade. Network server-class machines have much more. Saving a cycle or two on the processor these days is pretty meaningless. It's one thing when you're developing OS system code or low-level system processes, but for parsing a template, you're wasting your time.
| 0 | 0 | 0 | 0 |
2011-06-23T15:28:00.000
| 3 | 0.197375 | false | 6,456,627 | 0 | 0 | 1 | 3 |
Which is more efficient in Django: to render an object using the template language? or to push the code to render the object via a templatetag function using the python language?
|
django templates performance
| 6,456,742 | 3 | 4 | 673 | 0 |
python,django,performance,django-templates
|
The question is sort-of nonsensical. Templates are always going to be slower than a hand-tuned rendering solution, but template tags still need to run through the Template machinery, so you lose out any advantage there. If you want ultra-high efficiency, consider writing all of the HTML as an array of Python strings, join() them once and then pass your HTML back as the body of an HTTPResponse object.
Or, you could try all three and profile them. Since we don't know your code, we can't do that work for you. After a couple of experiments, you should be satisfied with which approach is correct for you.
The templating engine is almost never your bottleneck. You database is your most likely bottleneck. You do have the Django Toolbar installed, right? If the templating engine is not where your performance is at issue, always use the solution that cheapest for you to implement.
| 0 | 0 | 0 | 0 |
2011-06-23T15:28:00.000
| 3 | 0.197375 | false | 6,456,627 | 0 | 0 | 1 | 3 |
Which is more efficient in Django: to render an object using the template language? or to push the code to render the object via a templatetag function using the python language?
|
django templates performance
| 6,456,673 | 1 | 4 | 673 | 0 |
python,django,performance,django-templates
|
I'd say it's about the same; take the most clean way, and if you need speed, cache it.
| 0 | 0 | 0 | 0 |
2011-06-23T15:28:00.000
| 3 | 0.066568 | false | 6,456,627 | 0 | 0 | 1 | 3 |
Which is more efficient in Django: to render an object using the template language? or to push the code to render the object via a templatetag function using the python language?
|
MVC Game Design with objects
| 6,463,049 | 4 | 2 | 1,166 | 0 |
python,model-view-controller,oop
|
MVC can be counter-intuitive sometimes, especially when you're first learning OO and discover that having a "draw" method makes things so organized!
Here's an overview of one of many ways you might implement MVC for your game:
Model:
"Box": box_type, pos_x, pos_y
"BoxManager": list(Box)
"GameState": box_manager, player_manager, goal_manager, ...
"Move": dx, dy
Controller:
"GameController": check_valid_move(move), move_player(move), is_goal_state(), ...
View:
"Screen": render()
"PlayerRenderer": render()
"BoxRenderer": render_box(box), render_all_boxes()
Notice how the model is totally self-contained and does not reference the controller or view modules. This is one of the key aspects of MVC.
The controller takes player input and manipulates the global game state.
And the view looks at the global game state and renders the screen.
You don't have to go this route, but it's an option worth understanding and considering.
| 1 | 0 | 0 | 0 |
2011-06-24T03:20:00.000
| 3 | 1.2 | true | 6,462,967 | 1 | 0 | 1 | 3 |
I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function.
I am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view. Is there a good way to do this? Is this a case where I should not use a MVC design?
|
MVC Game Design with objects
| 11,327,596 | 0 | 2 | 1,166 | 0 |
python,model-view-controller,oop
|
One aspect that I'll just quickly make explicit is that when your model changes, it can't call the view to say "render this change" - because the model shouldn't know about the view(s).
Instead the model raises an event to say it has changed, and the view re-renders as necessary on receiving these. The view(s) know about the model, and subscribes to its events, but the model knows nothing about the things receiving the events.
As an example, I'm writing an OpenGL app, where the model contains simple normalized polygons and polyhedra, which are nice to work with geometrically, but are not convenient to pass to OpenGL. When the view receives an event saying the model has changed (a shape added or modified) then the view converts these polygons into the denormalised arrays of vertices that can be passed to OpenGL. This is an expensive operation, so the view caches these arrays in its own collection of "what needs to be rendered", and when it renders, it just iterates through this 'view collection', passing each array to OpenGL. So the view is the only code that knows about OpenGL, and is the only code that knows how to convert model state into OpenGL structures.
| 1 | 0 | 0 | 0 |
2011-06-24T03:20:00.000
| 3 | 0 | false | 6,462,967 | 1 | 0 | 1 | 3 |
I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function.
I am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view. Is there a good way to do this? Is this a case where I should not use a MVC design?
|
MVC Game Design with objects
| 6,463,038 | 0 | 2 | 1,166 | 0 |
python,model-view-controller,oop
|
Refactoring your code to conform to MVC would mean creating a "view" (like that represented your screen, and that view would have (for example) a draw method that took the "model" (a python object that contained all of the block states) and rendered that model to the screen.
Now perhaps all that draw method would do to render to the screen is call a renderToScreen(screenView) method on every block object. Or you might refactor that draw method into the view if you want to be more "pure".
| 1 | 0 | 0 | 0 |
2011-06-24T03:20:00.000
| 3 | 0 | false | 6,462,967 | 1 | 0 | 1 | 3 |
I wrote a simple sokoban like 2D game in python that I want to clean up. It's done in a sort-of OO way where each object in the game has a Draw function I can call to redraw the screen. It works out nicely since I can loop through each position on the screen and call the object's draw function.
I am learning about design patterns, and I really like the benefits of MVC, but I don't see a clean way to separate the draw function each object has from the model to put into the view. Is there a good way to do this? Is this a case where I should not use a MVC design?
|
Handle server error python
| 6,467,479 | 1 | 0 | 207 | 0 |
python,api,error-handling
|
The easiest solution will be probably to try to validate the user input before you use it. A simple regular expression which checks the last parts of the domain the user has entered might be enough.
If you want to support arbitrary domains without a google\.[a-z]+ or appspot.com suffix you will need another way to figure out if the site matches your requirements or not. Unfortunately there is no "is-powered-by-google-or-has-a-google-like-login-page" header, so you will probably need to look at the content and use some heuristics if the page is likely to be a such a page or not.
The kind of server error (500 interrnal server error) you are now encountering might mean a lot. This error indicates that there is something wrong with your application or server configuration. For example, if you deploy a script with a syntax error, the web server will response with "server error" when someone tries to access it. Also, if you want to divide by 0 or try to access an non-existing element this kind of error will be shown. So, server-errors are just a very general name for programming errors which should be avoided (and fixed!).
| 0 | 1 | 0 | 0 |
2011-06-24T10:54:00.000
| 2 | 0.099668 | false | 6,466,790 | 0 | 0 | 1 | 1 |
I m workin on an api where the user enters a domain and i need to redirect to the login page of that domain.
So this works for only google domains and i need to handle the error created when user enters non google domain . I m workin on google app engine.
I m new to dis error handling.So kindly explain how it works along with the solution
The error i recieved is
//Error: Server Error
The server encountered an error and could not complete your request.//
thaks in advance
|
Application access its own version in mercurial repository
| 6,471,560 | 5 | 3 | 91 | 0 |
python,mercurial
|
The best approach is probably to use precommit hook to replace a designated file with the output of hg log -r tip, possibly with a --template arg to format it in a particular way.
Unfortunately, there's a bit of a chicken and egg problem. The revision is a checksum of the commited data, but the checksum is not available until after the commit has taken place. One option might be to actually hook on commit instead of precommit, and commit the version info in a seperate changeset.
| 0 | 0 | 0 | 0 |
2011-06-24T17:20:00.000
| 3 | 0.321513 | false | 6,471,412 | 0 | 0 | 1 | 1 |
I have application I want to print out (in "about" box) its revision/version from mercurial. Suppose it is revision deadbeef so it will know that. In old times in CVS could use something like $Revision$ to substitute automatically.
What is best practice with Mercurial for this?
|
Avoiding "MySQL server has gone away" on infrequently used Python / Flask server with SQLAlchemy
| 58,821,330 | 6 | 64 | 33,654 | 1 |
python,mysql,sqlalchemy,flask,database-connection
|
The pessimistic approach as described by @wim
pool_pre_ping=True
can now be done for Flask-SQLAlchemy using a config var -->
SQLALCHEMY_POOL_PRE_PING = True
| 0 | 0 | 0 | 0 |
2011-06-24T17:34:00.000
| 7 | 1 | false | 6,471,549 | 0 | 0 | 1 | 2 |
How can Flask / SQLAlchemy be configured to create a new database connection if one is not present?
I have an infrequently visited Python / Flask server which uses SQLAlchemy. It gets visited every couple of days, and on the first visit it often throws a "MySQL server has gone away" error. Subsequent page views are fine, but it looks unprofessional to have this initial error.
I'd like to know the correct way to handle this - advice like "make a really long time out", which would be about 4 days long in this case, doesn't seem correct. How can I test for the lack of a database connection and create one if needed?
|
Avoiding "MySQL server has gone away" on infrequently used Python / Flask server with SQLAlchemy
| 51,015,137 | 2 | 64 | 33,654 | 1 |
python,mysql,sqlalchemy,flask,database-connection
|
When I encountered this error I was storing a LONGBLOB / LargeBinary image ~1MB in size. I had to adjust the max_allowed_packet config setting in MySQL.
I used mysqld --max-allowed-packet=16M
| 0 | 0 | 0 | 0 |
2011-06-24T17:34:00.000
| 7 | 0.057081 | false | 6,471,549 | 0 | 0 | 1 | 2 |
How can Flask / SQLAlchemy be configured to create a new database connection if one is not present?
I have an infrequently visited Python / Flask server which uses SQLAlchemy. It gets visited every couple of days, and on the first visit it often throws a "MySQL server has gone away" error. Subsequent page views are fine, but it looks unprofessional to have this initial error.
I'd like to know the correct way to handle this - advice like "make a really long time out", which would be about 4 days long in this case, doesn't seem correct. How can I test for the lack of a database connection and create one if needed?
|
Do Django-nonrel and Django-SocialAuth play together nicely?
| 6,902,951 | 1 | 1 | 223 | 0 |
python,django-nonrel,django-socialauth
|
They do, the only issue you'll run into if you are using a non-rel database is that the admin modules for Social_Auth will not work. They use joins. I was considering forking the project to see if I could make them work with non-rel, but I ran out of time.
What I've done is setup two separate databases. I'm storing my users and social_auth information in a relational database and the rest of my site content in MongoDB. Seems to be working well so far but the project is still under development.
| 0 | 0 | 0 | 0 |
2011-06-24T21:19:00.000
| 1 | 1.2 | true | 6,473,879 | 0 | 0 | 1 | 1 |
Anybody got Django-SocialAuth working with Django-nonrel?
Do they work together?
Please let me know if you have done it. Any gotchas to watch for?
|
Django - use generic views or not?
| 6,485,173 | 3 | 7 | 3,542 | 0 |
python,django,django-generic-views
|
Whether to use generic views or not is your prerogative. It won't cause you any trouble, although you might find yourself coding repetitious view logic. You might consider using wrapped/subclassed generic views in your views.py (frequently you'll want to customize them anyways), which would keep the boilerplate out of your urls.py and all the views in the same place.
| 0 | 0 | 0 | 0 |
2011-06-26T15:55:00.000
| 3 | 0.197375 | false | 6,485,005 | 0 | 0 | 1 | 2 |
I was going through quick poll tutorial on the Django site, and the last topic is introduction of generic views. A convenient way to bypass the need of creation of custom views for every URL pattern.
This is the main idea as far as I understand:
1) Request -> URL patterns -> View -> Template
or
2) Request -> URL patterns (Generic View) [-> optional Template]
2 seems to require less code, it's only two steps as opposed to four, but on the downside you're sticking more stuff into URL patterns, there's more automagic going on, and your views are now defined in two places.
I really like the idea of having URL Patterns just that - patterns, and not adding in additional boilerplate. I also like the idea of having all Views explicitly defined, even the simple ones, so that later I know where to find them all without going back and forth through files. Plus we all know that any automagic is harder to customise than something you build from scratch (at least from Django scratch).
Am I missing something? Am I doing a big mistake that will haunt me later of I don't use generic views at all?
|
Django - use generic views or not?
| 6,485,415 | 10 | 7 | 3,542 | 0 |
python,django,django-generic-views
|
The intention of Generic Views is to reduce boilerplate code when you repeatedly use similar code in several views. You should really use it just for that. Basically, just because django allows something you are doing generically you shouldn't do it, particularly not when your code becomes not to your like.
If you are using django-1.3's Class Based Views, instead of passing many variables to the function in urls.py, you can override respective methods of interest, which provides the best of both worlds. - Less code, and more control.
| 0 | 0 | 0 | 0 |
2011-06-26T15:55:00.000
| 3 | 1.2 | true | 6,485,005 | 0 | 0 | 1 | 2 |
I was going through quick poll tutorial on the Django site, and the last topic is introduction of generic views. A convenient way to bypass the need of creation of custom views for every URL pattern.
This is the main idea as far as I understand:
1) Request -> URL patterns -> View -> Template
or
2) Request -> URL patterns (Generic View) [-> optional Template]
2 seems to require less code, it's only two steps as opposed to four, but on the downside you're sticking more stuff into URL patterns, there's more automagic going on, and your views are now defined in two places.
I really like the idea of having URL Patterns just that - patterns, and not adding in additional boilerplate. I also like the idea of having all Views explicitly defined, even the simple ones, so that later I know where to find them all without going back and forth through files. Plus we all know that any automagic is harder to customise than something you build from scratch (at least from Django scratch).
Am I missing something? Am I doing a big mistake that will haunt me later of I don't use generic views at all?
|
python reverse proxy spawning via cgi
| 6,531,642 | 2 | 1 | 488 | 0 |
python
|
You don't need to spawn another process, that would complicate things a lot. Here's how I would do it based on something similar in my current project :
Create a WSGI application, which can live behind a web server.
Create a request handler (or "view") that is accessible from any URL mapping as long as the user doesn't have a session ID cookie.
In the request handler, the user can choose the target application and with it, the hostname, port number, etc. This request handler creates a connection to the target application, for example using httplib and assigns a session ID to it. It sets the session ID cookie and redirects the user back to the same page.
Now when your user hits the application, you can use the already open http connection to redirect the query. Note that WSGI supports passing back an open file-like object as response, including those provided by httplib, for increased performance.
| 0 | 1 | 0 | 1 |
2011-06-27T05:10:00.000
| 1 | 0.379949 | false | 6,488,806 | 0 | 0 | 1 | 1 |
I need to write a cgi page which will act like a reverse proxy between the user and another page (mbean). The issue is that each mbean uses different port and I do not know ahead of time which port user will want to hit.
Therefore want I need to do is following:
A) Give user a page which will allow him to choose which application he wants to hit
B) spawn a reverse proxy base on information above (which gives me port, server, etc..)
C) the user connects to the remote mbean page via the reverse proxy and therefore never "leaves" the original page.
The reason for C is that user does not have direct access to any of the internal apps only has access to initial port 80.
I looked at twisted and it appears to me like it can do the job. What I don't know is how to spawn twisted process from within cgi so that it can establish the connection and keep further connection within the reverse proxy framework.
BTW I am not married to twisted, if there is another tool that would do the job better, I am all ears. I can't do things like mod_proxy (for instance) since the wide range of ports would make configuration rather silly (at around 1000 different proxy settings).
|
What python based ajax push servers are good to work with
| 6,529,595 | 0 | 3 | 1,481 | 0 |
python,real-time,comet,ajax-push
|
I think the most popular is tornado open-sourced by facebook. It also has pretty decent documentation.
| 0 | 0 | 0 | 0 |
2011-06-27T13:17:00.000
| 3 | 0 | false | 6,493,444 | 0 | 0 | 1 | 2 |
I have a web application im currently working on in python. I'm using Django as my web framework currently. I intend to integrate real-time web features into the application using ajax push. However, I'm a bit confused as to what python based push server i should adopt. I've heard of a few of them, Orbited, Gevent, Tornado, but my main issue right now is that i'm a green horn when it comes to realtime web applications. I'd like to use python and i'd like a framework with good documentation.
|
What python based ajax push servers are good to work with
| 6,494,673 | 0 | 3 | 1,481 | 0 |
python,real-time,comet,ajax-push
|
APE seems a cool thing.
I think it's not a problem to make it work with PDjango as a backend.
| 0 | 0 | 0 | 0 |
2011-06-27T13:17:00.000
| 3 | 0 | false | 6,493,444 | 0 | 0 | 1 | 2 |
I have a web application im currently working on in python. I'm using Django as my web framework currently. I intend to integrate real-time web features into the application using ajax push. However, I'm a bit confused as to what python based push server i should adopt. I've heard of a few of them, Orbited, Gevent, Tornado, but my main issue right now is that i'm a green horn when it comes to realtime web applications. I'd like to use python and i'd like a framework with good documentation.
|
Parsing HTML with Python 2.7 - HTMLParser, SGMLParser, or Beautiful Soup?
| 6,494,288 | -4 | 16 | 6,435 | 0 |
python,html,parsing,beautifulsoup,html-parsing
|
Well, software is like cars....different flavors about all do drive!
Go with BeautifulSoup (4).
| 0 | 0 | 1 | 0 |
2011-06-27T14:11:00.000
| 4 | -1 | false | 6,494,199 | 0 | 0 | 1 | 2 |
I want to do some screen-scraping with Python 2.7, and I have no context for the differences between HTMLParser, SGMLParser, or Beautiful Soup.
Are these all trying to solve the same problem, or do they exist for different reasons? Which is simplest, which is most robust, and which (if any) is the default choice?
Also, please let me know if I have overlooked a significant option.
Edit: I should mention that I'm not particularly experienced in HTML parsing, and I'm particularly interested in which will get me moving the quickest, with the goal of parsing HTML on one particular site.
|
Parsing HTML with Python 2.7 - HTMLParser, SGMLParser, or Beautiful Soup?
| 6,494,502 | 6 | 16 | 6,435 | 0 |
python,html,parsing,beautifulsoup,html-parsing
|
BeautifulSoup in particular is for dirty HTML as found in the wild. It will parse any old thing, but is slow.
A very popular choice these days is lxml.html, which is fast, and can use BeautifulSoup if needed.
| 0 | 0 | 1 | 0 |
2011-06-27T14:11:00.000
| 4 | 1 | false | 6,494,199 | 0 | 0 | 1 | 2 |
I want to do some screen-scraping with Python 2.7, and I have no context for the differences between HTMLParser, SGMLParser, or Beautiful Soup.
Are these all trying to solve the same problem, or do they exist for different reasons? Which is simplest, which is most robust, and which (if any) is the default choice?
Also, please let me know if I have overlooked a significant option.
Edit: I should mention that I'm not particularly experienced in HTML parsing, and I'm particularly interested in which will get me moving the quickest, with the goal of parsing HTML on one particular site.
|
Python: PyCurl set URL exception
| 6,495,548 | 9 | 1 | 5,514 | 0 |
python,curl,pycurl
|
The problem is that it accepts strings, not unicode objects. Remove the u and unicode().
| 0 | 0 | 0 | 0 |
2011-06-27T15:16:00.000
| 2 | 1.2 | true | 6,495,077 | 0 | 0 | 1 | 1 |
I try to set the url using this code c.setopt(pycurl.URL, link), but I get the following exception
File "/home/sultan/Repository/Django/monitor/app/thread/utils.py", line 164, in perform
self.proxy_request.setopt(pycurl.URL, u'%s' % unicode(link))
TypeError: invalid arguments to setopt
What is wrong with my code?
Sultan
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.