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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Language best for a Photo-sharing site: PHP, Python, Ruby or something else?
| 8,051,192 | 2 | 4 | 1,102 | 0 |
php,python,ruby,scalability
|
PHP can do it well. Python also can do it using web frameworks like Django or turbogears.
That being said, language is not an issue as long as it has web capabilities which your post seems to dictate
| 0 | 0 | 0 | 1 |
2011-11-08T13:25:00.000
| 3 | 0.132549 | false | 8,051,087 | 0 | 0 | 1 | 3 |
I plan to build a photo-sharing site like Flickr/Picasa for photographers, with features most suited for them. As you know, if that venture proves successful, many GB to TB of data transfers take place every day.
This question is not just about scalability of my application as it grows, but also performance. I would like to make an informed decision. I think I'd go with MySQL database, JavaScript/jQuery for client-side scripting, but what server-side language with it, is the question - - PHP, Python, Ruby or something else?
And there are definitely somethings to keep in mind when developing an application (i.e., scalable coding) that needs to scale over a period time. If any that you would like to suggest, what are they?
NOTE: I am specifying "Photo-sharing site" in order to give you an idea of my mission. Otherwise, this question wouldn't look as subjective. Kindly take it that way.
|
Language best for a Photo-sharing site: PHP, Python, Ruby or something else?
| 8,052,193 | 0 | 4 | 1,102 | 0 |
php,python,ruby,scalability
|
I've done Web applications in PHP, ColdFusion, Java, and Ruby, with various frameworks. I find Rails to be the most powerful Web framework I've ever used. Nothing can really equal it, because the power comes from the Ruby language, and no other language (except maybe Smalltalk) can really equal that. That said, as long as you use proper development practice, you should be able to get it done in almost any language.
However, you do not want to use MySQL as a database. PostgreSQL is far more powerful and scalable, and doesn't have MySQL's silly limitations and gotchas.
| 0 | 0 | 0 | 1 |
2011-11-08T13:25:00.000
| 3 | 0 | false | 8,051,087 | 0 | 0 | 1 | 3 |
I plan to build a photo-sharing site like Flickr/Picasa for photographers, with features most suited for them. As you know, if that venture proves successful, many GB to TB of data transfers take place every day.
This question is not just about scalability of my application as it grows, but also performance. I would like to make an informed decision. I think I'd go with MySQL database, JavaScript/jQuery for client-side scripting, but what server-side language with it, is the question - - PHP, Python, Ruby or something else?
And there are definitely somethings to keep in mind when developing an application (i.e., scalable coding) that needs to scale over a period time. If any that you would like to suggest, what are they?
NOTE: I am specifying "Photo-sharing site" in order to give you an idea of my mission. Otherwise, this question wouldn't look as subjective. Kindly take it that way.
|
Language best for a Photo-sharing site: PHP, Python, Ruby or something else?
| 8,051,120 | 7 | 4 | 1,102 | 0 |
php,python,ruby,scalability
|
Any. The language doesn't matter. Ruby-fanatics (especially the RubyOnRails sort) will try and tell you that their language will do everything in only 10 lines and it'll make you dinner and pick the kids up from school. Others will tell you that their language is the most secure, fastest, quickest to develop in, etc. Ignore them.
I love Python and I'd love to recommend it - but seriously, it won't make a difference. Just pick the language you know the best and get writing. So if that's Java, start writing Java. If that's C++, hell, start writing C++.
I don't believe the people who say that [insert language here] is fastest to develop in. It's all about what you find comfortable. Some langauges provide extra functionality but you can always write a library that provides that if you need it - it shouldn't take too long and, chances are, someone has already done it.
Remember: Facebook is written in PHP (though they compile a lot of that PHP to C++ now for speed), MySpace was written in C#/ColdFusion (I believe), Twitter uses Ruby On Rails (though they plan to abandon it apparently), Google uses Java/Go (I think) and LinkedIn uses ASP.net or something I think. My point is - tonnes of services, tonnes of languages and they're all doing ok. Right now, any language will do.
My favourite little phrase is "just build it". Whilst it's a good idea to have a nice architecture and think about performance and scalability - if those things will make you abandon the project half way through, what's the point in bothering? Besides, chances are you'll need to recode a large part of it anyway later on, assuming the project grows. Really think that Facebook are using the same code they were at the start?
So, in summary, pick whichever language you want. It'll be fine.
| 0 | 0 | 0 | 1 |
2011-11-08T13:25:00.000
| 3 | 1.2 | true | 8,051,087 | 0 | 0 | 1 | 3 |
I plan to build a photo-sharing site like Flickr/Picasa for photographers, with features most suited for them. As you know, if that venture proves successful, many GB to TB of data transfers take place every day.
This question is not just about scalability of my application as it grows, but also performance. I would like to make an informed decision. I think I'd go with MySQL database, JavaScript/jQuery for client-side scripting, but what server-side language with it, is the question - - PHP, Python, Ruby or something else?
And there are definitely somethings to keep in mind when developing an application (i.e., scalable coding) that needs to scale over a period time. If any that you would like to suggest, what are they?
NOTE: I am specifying "Photo-sharing site" in order to give you an idea of my mission. Otherwise, this question wouldn't look as subjective. Kindly take it that way.
|
Getting the final destination of a javascript redirect on a website
| 8,053,358 | -1 | 3 | 5,021 | 0 |
python,urllib2
|
It doesnt sound like fun to me, but every javascript function is a is also an object, so you can just read the function rather than call it and perhaps the URL is in it. Otherwise, that function may call another which you would then have to recurse into... Again, doesnt sound like fun, but might be doable.
| 0 | 0 | 1 | 0 |
2011-11-08T15:58:00.000
| 2 | -0.099668 | false | 8,053,295 | 0 | 0 | 1 | 1 |
I parse a website with python. They use a lot of redirects and they do them by calling javascript functions.
So when I just use urllib to parse the site, it doesn't help me, because I can't find the destination url in the returned html code.
Is there a way to access the DOM and call the correct javascript function from my python code?
All I need is the url, where the redirect takes me.
|
on Windows, virtualenv is not being used with i run a python program
| 8,069,779 | 1 | 2 | 576 | 0 |
python,windows,django,virtualenv
|
Virtualenv modifies the PATH to include a Python with the correct setup. It's a completely separate program from the system Python.
The PATH is used to look up programs by name: the first program of a given name that's in the PATH gets executed.
When you “run a file”, Windows uses the extension of the file to look up a program to run. It doesn't look it up by the name of the program, and so doesn't check the PATH.
The solution is to explicitly invoke Python from the command line (python manage.py) while a virtualenv is active. This way, Windows will search PATH for what you meant by “python”, and find the correct one.
| 0 | 0 | 0 | 0 |
2011-11-09T17:30:00.000
| 3 | 0.066568 | false | 8,069,029 | 1 | 0 | 1 | 1 |
I have virtualenv installed on windows.
In cmd, i run python and look at sys.path and see the virtualenv path included.
but when i run manage.py (for django), I don't see the virtualenv path,
so virtualenv is not working with django server.
Why?
|
Connect appengine with cakephp
| 8,070,747 | 0 | 0 | 378 | 1 |
php,python,google-app-engine,cakephp
|
You can not run PHP on GAE. If you run PHP somewhere, it is a bad architecture to go over the internet for your data. It will be slooooow and a nightmare to develop in.
You should store your data where you run your php, unless you must have a distributed, globally scaling architecture, which afaiu not the case.
| 0 | 1 | 0 | 0 |
2011-11-09T18:21:00.000
| 5 | 0 | false | 8,069,649 | 0 | 0 | 1 | 1 |
I'm thinking in create a webapplication with cakephp but consuming python's appengine webservice. But, to install cakephp etc, I need to configure the database. Appengine uses another kind of datastorage, with is different from mysql, etc.
I was thinking in store the data in appengine, and using the python webservices, and with the cakephp application comunicating with the webservice, for insert and retrieve data.
Is there any good resource for this, or is it unpossible.
Obs: also opened for a possibility for developing the webapplicaiton completely in python running in appengine. If anyone has a good resource.
Thanks.
|
Time zones and Localisation
| 8,099,104 | 1 | 1 | 1,526 | 0 |
python,django,timezone,python-datetime
|
The problem with relying on the client to self-report their time zone is that there is always a chance (how big of a chance is debateable) that what you will really get is a UTC offset. If you get a UTC offset, your logic will work fine most of the time, but in reality will only apply to the exact timestamps produced by the client. Any past or future times may have a different UTC offset, and that can't be predicted without a proper time zone database. Near the daylight savings boundary, using UTC offsets can produce catastrophically wrong results.
Even besides that, some non-literate users (i.e. grandma) may not know how to set the time zone of their local system; or users on tunnelled sessions or virtual machines may have a "local" time zone that is not set for their actual preference.
Guessing the political time zone of the client based on what you know about that client (IP, etc) can be wrong, and can be quite annoying if there is no way for the user to override the guess. But for anonymous users or new user sign-up I see nothing wrong with using such a method as an initial guess, as long as you give the user some way to change it if it's wrong.
My recommendation would be specifically:
Include the Olson time zone as part of any user profile. The time zones can be looked up by country, and this should make user selection of their time zone relatively painless. Give the 0.01% of users who care the choice of straight-up UTC also :-)
If you populate the default in the user profile with an IP-based guess, you'll be right most of the time if you use a good lookup service. But allow the user to change it if it's wrong.
For anonymous users, provide some kind of widget on any page that displays or inputs local times, that lets them select their Olson time zone, in much the same way as for a user profile. Store the value they choose in a cookie. Default to UTC or to a guessed value as above.
In implementing a web-based application previously that needed to display timestamps in localized times, I found that not all clients translate UTC to local times correctly for past and future dates. I had to perform all conversions on the server side. This may necessitate a web service that takes a local time and an Olson time zone and returns a UTC time.
| 0 | 0 | 0 | 0 |
2011-11-10T04:37:00.000
| 5 | 1.2 | true | 8,075,052 | 1 | 0 | 1 | 2 |
I'm currently storing all times in UTC, to make things easier for when I start bringing multiple sites and servers online.
The problem comes in when translating date and datetime objects into strings in my templates and when accepting user input. 6:00PM UTC doesn't mean a whole lot to someone who is in PST. Likewise, asking users to input times in UTC is asking for disaster.
How can I correctly translate these values in a smart, not-error-prone way? Is there a way I can determine from the HTTP request what timezone a user is in? I really need a way to determine the user's timezone with as little effort as possible.
|
Time zones and Localisation
| 8,075,182 | 0 | 1 | 1,526 | 0 |
python,django,timezone,python-datetime
|
I wouldn't do ip geolocation. It can be very inaccurate, especially free services. Just ask the user for zip code or state, and store it in cookie.
| 0 | 0 | 0 | 0 |
2011-11-10T04:37:00.000
| 5 | 0 | false | 8,075,052 | 1 | 0 | 1 | 2 |
I'm currently storing all times in UTC, to make things easier for when I start bringing multiple sites and servers online.
The problem comes in when translating date and datetime objects into strings in my templates and when accepting user input. 6:00PM UTC doesn't mean a whole lot to someone who is in PST. Likewise, asking users to input times in UTC is asking for disaster.
How can I correctly translate these values in a smart, not-error-prone way? Is there a way I can determine from the HTTP request what timezone a user is in? I really need a way to determine the user's timezone with as little effort as possible.
|
Web Frameworks with site style inbuilt
| 8,082,137 | 1 | 0 | 249 | 0 |
python,css,frameworks
|
I feel your pain. As a developer coming from the desktop world and doing some web development, I'm used to setting up the appearance of my application at the same time I select and arrange my user interface widgets.
You will just have to accept that browser based software does not work that way. You must separately learn CSS. Hopefully, you'll learn to like this method of specifying the appearance of the application but whether you do or not there really isn't any alternative to this approach in the browser.
| 0 | 0 | 0 | 1 |
2011-11-10T10:12:00.000
| 4 | 0.049958 | false | 8,077,886 | 0 | 0 | 1 | 2 |
I hope this isn't knocked for being too general, but... I recently had occasion to learn web2py for a final year university project. In this subject teams of four had 8 weeks to design a web app. Ultimately i found that web2py was quite versatile, with it being very easy to get a site up and running fast, a lot of options (janrain etc) - but the end "style" result relied almost entirely on us.
Amongst the other teams, who used other frameworks (each team a different one on the whole), a few of the sites came out with a very slick polished look, without them having to spend much photoshop/css design time and effort. I got the impression that some frameworks are more "friendly" when it came to out of the box design elements (buttons, navigation options, widgets, base css etc) while others aren't.
I have a python (/C/java) background, and intend to learn PHP some point. What frameworks exist out there that provided a base for site design beyond the bare bones? And to emphasise, I have browsed the python page listing frameworks, i am more interested in the design aspect - even if just to see if my assumption was correct.
|
Web Frameworks with site style inbuilt
| 8,085,839 | 1 | 0 | 249 | 0 |
python,css,frameworks
|
So far what I've seen about Yii Framework (PHP) is that it can generate an initial nice Styled Web Application backbone, ready for you to work in it adding your functionality, DBs, User roles, etc. and of course all the freedom to define your own Look and Feel by defining HTML views, CSS, JS, etc.
I'm about to start learning and using a PHP Framework for my next project. I have never yet used a Framework but I have several years using PHP/MySQL.
For some weeks I have researched on PHP Frameworks and there are CakePHP, CodeIgniter, Zend, Yii, Kohana, etc. and I'm leaning to Yii even though CodeIgniter seems to have more followers I'm stubborn on checking out Yii because of the high praise is getting specially in its quality built and performance.
I wouldn't know how good the other PHP frameworks are on the "default visual style" area.
| 0 | 0 | 0 | 1 |
2011-11-10T10:12:00.000
| 4 | 0.049958 | false | 8,077,886 | 0 | 0 | 1 | 2 |
I hope this isn't knocked for being too general, but... I recently had occasion to learn web2py for a final year university project. In this subject teams of four had 8 weeks to design a web app. Ultimately i found that web2py was quite versatile, with it being very easy to get a site up and running fast, a lot of options (janrain etc) - but the end "style" result relied almost entirely on us.
Amongst the other teams, who used other frameworks (each team a different one on the whole), a few of the sites came out with a very slick polished look, without them having to spend much photoshop/css design time and effort. I got the impression that some frameworks are more "friendly" when it came to out of the box design elements (buttons, navigation options, widgets, base css etc) while others aren't.
I have a python (/C/java) background, and intend to learn PHP some point. What frameworks exist out there that provided a base for site design beyond the bare bones? And to emphasise, I have browsed the python page listing frameworks, i am more interested in the design aspect - even if just to see if my assumption was correct.
|
Customizing the Django User admin
| 8,092,344 | 0 | 0 | 521 | 0 |
python,django,django-models,django-admin
|
Turns out, one can put the methods in the UserAdmin itself instead than in the User model. This way I can access all the information I need about the user.
| 0 | 0 | 0 | 0 |
2011-11-11T09:52:00.000
| 2 | 1.2 | true | 8,092,254 | 0 | 0 | 1 | 1 |
I have a Django application where users have additional data. That data is collected in a Profile model with a OneToOneField pointing to User.
This is fine and works perfectly for most purposes, but I have trouble customizing the admin for User. In particular:
I would like to be able to show a Profile field inside list_display. I don't know how to do this without writing an additional method on User itself.
I would like to be able to show some information about related models (e.g. some resources owned by the user) inside the User detail page. Again, I do not know how to do this without writing a custom User method.
Do you know any solution to the above?
|
jquery - can I detect once all content is loaded?
| 8,093,470 | 0 | 3 | 6,659 | 0 |
jquery,events,python-idle
|
Ideally the answer would be $(function(){ }) or window.onload = function(){} that fires after all the DOM contents are loaded. But I guess, the ads on your page starts loading asynchronously after the DOM load.
So, assuming you know the number of 'ads' on your page (you said you are loading them piece by piece), my advise would be to increment a counter on each successful 'ad' load. When that counter reaches the total number of ads, you fire a 'all_adv_loaded' function.
| 0 | 0 | 1 | 1 |
2011-11-11T11:26:00.000
| 4 | 0 | false | 8,093,297 | 0 | 0 | 1 | 1 |
I have a page with a lot of ads being loaded in piece by piece.
I need to position an element relative to overall page height, which is changing during load, because of ads being added.
Question: Is there a jquery event or similar to detect, when all elements are loaded? I'm currently "waiting" with setTimeout, but this is far from nice.
An idle event would be nice, which fires once after pageload if no new http requests are made for xyz secs.
|
How do I confirm a form has been submitted with django?
| 8,097,716 | 0 | 1 | 3,238 | 0 |
python,django
|
Honestly, this isn't a Django-specific issue. The problem is whether you are doing a normal form submission or using AJAX.
The basic idea is to POST to your form submission endpoint using AJAX and the form data, and in the Django view, merely update your models and return either an empty 200 response or some data (in XML, JSON, small HTML, whatever you need). Then the AJAX call can populate a success message div on success, or display a failure message if it gets back a non-200 response.
| 0 | 0 | 0 | 0 |
2011-11-11T17:23:00.000
| 3 | 0 | false | 8,097,644 | 0 | 0 | 1 | 1 |
I'm submitting a form and instead of redirecting to a success url I would like to just show "Form has been submitted" in text on the page when the form has been submitted. Does anyone know how I can do so?
|
Sending data through the web to a remote program using python
| 8,098,102 | 2 | 1 | 403 | 0 |
python,networking
|
I would suggest taking a look at setting up a simple site in google app engine. It's free and you can use python to do the site. Than it would just be a matter of creating a simple restful service that you could send a POST to with your pickled data and store it in a database. Than just create a simple web front end onto the database.
| 0 | 0 | 1 | 0 |
2011-11-11T18:02:00.000
| 4 | 0.099668 | false | 8,098,068 | 0 | 0 | 1 | 4 |
I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to store the data by sending pickled strings to the address. This would allow for anyone to access the address and simply read the newest e-mail to get the data. It worked perfectly, but the program requires a new e-mail to be sent every 5-30 seconds. So the method fell through because of the limit g-mail has on e-mails, among other reasons, such as I was unable to completely delete old e-mails.
Now I want to try a different idea, but I do not know very much about network programming with python. I want to setup a webpage with essentially nothing on it. The "master" program, the program actually collecting the data, will send a pickled string to the webpage. Then any of the "remote" programs will be able to read the string. I will also need the master program to delete old strings as it updates the webpage. It would be preferred to be able to store multiple string, so there is no chance of the master updating while the remote is reading.
I do not know if this is a feasible task in python, but any and all ideas are welcome. Also, if you have an ideas on how to do this a different way, I am all ears, well eyes in this case.
|
Sending data through the web to a remote program using python
| 8,098,342 | 0 | 1 | 403 | 0 |
python,networking
|
Adding this as an answer so that OP will be more likely to see it...
Make sure you consider security! If you just blindly accept pickled data, it can open you up to arbitrary code execution.
| 0 | 0 | 1 | 0 |
2011-11-11T18:02:00.000
| 4 | 0 | false | 8,098,068 | 0 | 0 | 1 | 4 |
I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to store the data by sending pickled strings to the address. This would allow for anyone to access the address and simply read the newest e-mail to get the data. It worked perfectly, but the program requires a new e-mail to be sent every 5-30 seconds. So the method fell through because of the limit g-mail has on e-mails, among other reasons, such as I was unable to completely delete old e-mails.
Now I want to try a different idea, but I do not know very much about network programming with python. I want to setup a webpage with essentially nothing on it. The "master" program, the program actually collecting the data, will send a pickled string to the webpage. Then any of the "remote" programs will be able to read the string. I will also need the master program to delete old strings as it updates the webpage. It would be preferred to be able to store multiple string, so there is no chance of the master updating while the remote is reading.
I do not know if this is a feasible task in python, but any and all ideas are welcome. Also, if you have an ideas on how to do this a different way, I am all ears, well eyes in this case.
|
Sending data through the web to a remote program using python
| 8,099,975 | 0 | 1 | 403 | 0 |
python,networking
|
I suggest you to use a good middle-ware like: Zero-C ICE, Pyro4, Twisted.
Pyro4 using pickle to serialize data.
| 0 | 0 | 1 | 0 |
2011-11-11T18:02:00.000
| 4 | 0 | false | 8,098,068 | 0 | 0 | 1 | 4 |
I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to store the data by sending pickled strings to the address. This would allow for anyone to access the address and simply read the newest e-mail to get the data. It worked perfectly, but the program requires a new e-mail to be sent every 5-30 seconds. So the method fell through because of the limit g-mail has on e-mails, among other reasons, such as I was unable to completely delete old e-mails.
Now I want to try a different idea, but I do not know very much about network programming with python. I want to setup a webpage with essentially nothing on it. The "master" program, the program actually collecting the data, will send a pickled string to the webpage. Then any of the "remote" programs will be able to read the string. I will also need the master program to delete old strings as it updates the webpage. It would be preferred to be able to store multiple string, so there is no chance of the master updating while the remote is reading.
I do not know if this is a feasible task in python, but any and all ideas are welcome. Also, if you have an ideas on how to do this a different way, I am all ears, well eyes in this case.
|
Sending data through the web to a remote program using python
| 8,098,220 | 1 | 1 | 403 | 0 |
python,networking
|
Another option in addition to what Casey already provided:
Set up a remote MySQL database somewhere that has user access levels allowing remote connections. Your Python program could then simply access the database and INSERT the data you're trying to store centrally (e.g. through MySQLDb package or pyodbc package). Your users could then either read the data through a client that supports MySQL or you could write a simple front-end in Python or PHP that displays the data from the database.
| 0 | 0 | 1 | 0 |
2011-11-11T18:02:00.000
| 4 | 0.049958 | false | 8,098,068 | 0 | 0 | 1 | 4 |
I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to store the data by sending pickled strings to the address. This would allow for anyone to access the address and simply read the newest e-mail to get the data. It worked perfectly, but the program requires a new e-mail to be sent every 5-30 seconds. So the method fell through because of the limit g-mail has on e-mails, among other reasons, such as I was unable to completely delete old e-mails.
Now I want to try a different idea, but I do not know very much about network programming with python. I want to setup a webpage with essentially nothing on it. The "master" program, the program actually collecting the data, will send a pickled string to the webpage. Then any of the "remote" programs will be able to read the string. I will also need the master program to delete old strings as it updates the webpage. It would be preferred to be able to store multiple string, so there is no chance of the master updating while the remote is reading.
I do not know if this is a feasible task in python, but any and all ideas are welcome. Also, if you have an ideas on how to do this a different way, I am all ears, well eyes in this case.
|
Django - Consuming a RESTful service asynchronously
| 8,130,058 | 4 | 4 | 890 | 0 |
python,django,rest
|
django-celery is a popular choice for async tasks, i usually use greenlets as im used to them.
Then to notify the user you can use the notification framework to tell the client that something is done.
| 0 | 0 | 0 | 0 |
2011-11-11T20:41:00.000
| 1 | 1.2 | true | 8,099,699 | 0 | 0 | 1 | 1 |
I need to create a django web portal in which users can select and run ad-hoc reports by providing values, via forms, to parameters defined in each specific report. The view that processes the user’s report execution requests needs to make RESTFul service calls to a remote Jasper Reports Server where the actual output is generated.
I have already written the client to make the RESTful service calls to the remote server. Depending on how large the report is the service calls can take several minutes.
What is the best method for making the service call after the user’s form has been validated so that the call processes asynchronously (in the background) and the user can continue you use the web portal while their report is being generated.
Do I need to make an AJAX call when the parameters form is submitted or should I start a new thread for the RESTful client in the view after the form has validated? Or something else?
|
Can a Heroku app use different/multiple ports?
| 8,110,748 | 0 | 7 | 8,631 | 0 |
python,email,heroku,port
|
Custom mail server? Nope.
Heroku's mail services? Yes, check out the "Add-On" link for cloudmailin, mailgun and sendgrid. Basic service is free (they still want your credit-card and hope you exceed free quota).
| 0 | 0 | 0 | 0 |
2011-11-12T21:39:00.000
| 3 | 0 | false | 8,107,748 | 0 | 0 | 1 | 2 |
Web services on Heroku normally use the PORT environment variable, but I want to run a custom mail server on Heroku. So I need to expose 2 ports, preferably 110 and 25, but I can live with alternatives. Is it possible?
|
Can a Heroku app use different/multiple ports?
| 8,107,804 | 3 | 7 | 8,631 | 0 |
python,email,heroku,port
|
No, just running some quick tests against the heroku proxy (proxy.heroku.com) I can only make connections to ports 80 and 443. Being as heroku don't provide any POP/SMTP it doesn't make sense for them to have those ports open I'm afraid.
| 0 | 0 | 0 | 0 |
2011-11-12T21:39:00.000
| 3 | 0.197375 | false | 8,107,748 | 0 | 0 | 1 | 2 |
Web services on Heroku normally use the PORT environment variable, but I want to run a custom mail server on Heroku. So I need to expose 2 ports, preferably 110 and 25, but I can live with alternatives. Is it possible?
|
Downloading PDF files with Scrapy
| 8,113,814 | 0 | 0 | 1,740 | 0 |
python,session,cookies,scrapy
|
I think the site tracks your session. If it's a PHP site, pass PHPSESSID cookie to the request which downloads the PDF file.
| 0 | 0 | 1 | 0 |
2011-11-12T23:54:00.000
| 1 | 0 | false | 8,108,477 | 0 | 0 | 1 | 1 |
I'm scraping pdf files from a site using Scrapy, a Python web-scraping framework.
The site requires to follow the same session in order to allow you to download the pdf.
It works great with Scrapy's because it's all automated but when I run the script after a couple of seconds it starts to give me fake pdf files like when I try to access directly the pdf, without my session.
Why is that so & any idea how to overcome this problem!?
|
tools or techniques to help avoid mistakes in python/django
| 8,152,166 | 0 | 2 | 189 | 0 |
python,django,debugging,static-analysis
|
Thank you for your answers, I'll check these tools.
I wanted to share with you other ideas (none python/django specific):
Assert conditions in code - but remove from production code.
Run periodic checks on the data (eg. sending email to dev when found unexpected state) - in case a bug slips by it may be detected faster, before more data is corrupt (but alas after some of it is already corrupt).
Make a single bottom-line test (perhaps simulating user input), that covers most of the program. It may catch exceptions and asserts and is may be easier to maintain than many tests.
| 0 | 0 | 0 | 1 |
2011-11-13T10:31:00.000
| 3 | 0 | false | 8,110,952 | 1 | 0 | 1 | 1 |
What tools or techniques can help avoid bugs, especially silly mistakes such as typos, coding in Python and Django?
I know unit-testing every line of code is the "proper" way, but are there any shortcuts?
I know of pylint, but unfortunately it doesn't check Django ORM named parameters, where a typo can go unnoticed. Is there any tool that can handle this kind of bugs?
A colleague thought of an idea to gather smart statistics on tokens (for example about named parameters to functions...), and when a once-in-a-code-base token is encountered it is warned as possible typo.
Do you know of any tool that does something similar?
|
BeautifulSoup innerhtml?
| 63,989,449 | 3 | 64 | 53,337 | 0 |
python,html,beautifulsoup,innerhtml
|
str(element) helps you to get outerHTML, then remove outer tag from the outer html string.
| 0 | 0 | 0 | 0 |
2011-11-13T16:26:00.000
| 7 | 0.085505 | false | 8,112,922 | 0 | 0 | 1 | 2 |
Let's say I have a page with a div. I can easily get that div with soup.find().
Now that I have the result, I'd like to print the WHOLE innerhtml of that div: I mean, I'd need a string with ALL the html tags and text all toegether, exactly like the string I'd get in javascript with obj.innerHTML. Is this possible?
|
BeautifulSoup innerhtml?
| 35,100,639 | 1 | 64 | 53,337 | 0 |
python,html,beautifulsoup,innerhtml
|
How about just unicode(x)? Seems to work for me.
Edit: This will give you the outer HTML and not the inner.
| 0 | 0 | 0 | 0 |
2011-11-13T16:26:00.000
| 7 | 0.028564 | false | 8,112,922 | 0 | 0 | 1 | 2 |
Let's say I have a page with a div. I can easily get that div with soup.find().
Now that I have the result, I'd like to print the WHOLE innerhtml of that div: I mean, I'd need a string with ALL the html tags and text all toegether, exactly like the string I'd get in javascript with obj.innerHTML. Is this possible?
|
Find untranslated strings in HTML templates
| 8,130,667 | 0 | 4 | 865 | 0 |
python,django,localization
|
You can use the builtin template parser to parse your templates, and recurse into all tags that are not instances of BlockTransTag
| 0 | 0 | 0 | 0 |
2011-11-14T09:14:00.000
| 2 | 0 | false | 8,119,360 | 0 | 0 | 1 | 1 |
Is there way to find untranslated strings in the HTML templates of my Django application i.e. blocks of text that are not wrapped in trans and blocktrans tags.
Since we have many templates, it would be a very time-consuming process to go through them manually and check but if there isn't an option, I guess it has to be done the long and tedious way.
Thanks
|
Model Creation by SQLAlchemy database reflection
| 8,125,931 | 4 | 3 | 1,319 | 1 |
python,reflection,sqlalchemy,pyramid
|
This doesn't seem to have much to do with "database reflection", but rather dynamic table creation. This is a pretty dangerous operation and generally frowned upon.
You should try to think about how to model the possible structure your users would want to add to the Base and design your schema around that. Sometimes these flexible structures can benefit a lot from vertical tables when you don't know what the columns may be.
Don't forget that there's an entire class of data storage systems out there that provide more flexible support for "schemaless" models. Something like Mongo or ZODB might make more sense here.
| 0 | 0 | 0 | 0 |
2011-11-14T13:09:00.000
| 4 | 0.197375 | false | 8,122,078 | 0 | 0 | 1 | 1 |
I am currently working on a pyramid system that uses sqlalchemy.
This system will include a model (let's call it Base) that is stored in a
database table. This model should be extensible by the user on runtime. Basically, the user
should be able to subclass the Base and create a new model (let's call this one 'Child').
Childs should be stored in another database table.
All examples available seem to handle database reflection on a predefined model.
What would be the best way to generate complete model classes via database reflection?
|
Best ways to stream live video to a webpage using Python/C++/Java
| 8,129,233 | 0 | 1 | 677 | 0 |
java,c++,python,streaming
|
What kind of live video source that you mean? If you don't intend to do this code-wise, you can use the free VLC Player to act as a streaming service in between any kind of media stream source (file, network, capture device, disc) and your web video client.
But, if you intend to do this code-wise, you can you VLCJ library. Other options can be Xuggler or FMJ.
| 0 | 0 | 0 | 0 |
2011-11-14T19:51:00.000
| 1 | 0 | false | 8,127,213 | 0 | 0 | 1 | 1 |
I want to read in a live video stream, like RTSP, run some basic processing on it, and display it on a website. What are some good ways to do this? I have used OpenCV for Python before but found it to be a hassle. I am also familiar with Java and C++ if there are better libraries available. I haven't done a lot of web development before either.
|
does Tornado uses WSGI to deal with python files?
| 8,129,321 | 3 | 1 | 444 | 0 |
python,wsgi,tornado
|
Tornado shouldn't use WSGI, because WSGI is not async friendly. It has WSGI support, but it won't support async.
Tornado has its own HTTP server (written in C and Python), and can be used standalone or placed behind another async HTTP server (usually Nginx).
| 0 | 1 | 0 | 0 |
2011-11-14T21:56:00.000
| 1 | 1.2 | true | 8,128,736 | 0 | 0 | 1 | 1 |
am sorry for that question,
am beginning in Tornado, and because i come from two other frameworks: Flask and Django, Flask uses Werkzeug which is a WSGI webserver, Django uses WSGI too, but, when making an application programmed with Tornado, how it will deal with HTTP? there is a protocol to deal with python files when it comes to internet? or do i mess something about WSGI?
NB: i know also that Tornado has a WSGI support, for example it can serve Django application, but i mean with a native Tornado application, which protocol it uses?
|
Performing a check when saving a model in Django's admin
| 8,140,229 | 3 | 4 | 2,403 | 0 |
python,django,django-admin
|
Simply create a modelform with normal validation via the clean methods, then assign that form to be used in the admin by doing form = MyFormClass inside the ModelAdmin class.
| 0 | 0 | 0 | 0 |
2011-11-15T16:44:00.000
| 3 | 1.2 | true | 8,139,892 | 0 | 0 | 1 | 1 |
I'd like to perform a check when saving a model via the django Admin panel. I thought about using ModelAdmin.save_model(), however, from the documentation it says:
ModelAdmin.save_model() and ModelAdmin.delete_model() must save/delete the object, they are not for veto purposes, rather they allow you to perform extra operations.
I need to perform a check to enforce time constraints, only if the model is being edited and in some case, I need to NOT perform the save. (e.g. If it's past midnight and the admin is trying to edit a model instance, I don't want to save the changes, and alert the admin that it's past midnight...)
What would be the best place to do that considering that ModelAdmin.save_model cannot veto the saving operation?
|
How to use a report from a view inside another view in Django?
| 8,143,409 | 0 | 0 | 54 | 0 |
python,django
|
you could always keep the files, and have a cron job that deletes files whose session has expired
| 0 | 0 | 0 | 0 |
2011-11-15T21:14:00.000
| 2 | 0 | false | 8,143,228 | 0 | 0 | 1 | 1 |
I have a form where I upload a file, and I generate a report out of it. The thing is, I would also like to make the report available for download, as an archive. I would like to somehow include the CSS and the JS ( that I inherit from my layout ) inside the report, but I don't really know how to go about this.
So far, I am not storing the file ( the report's being generated from ) on server side, I delete it after I'm done with it.
The only solution I could think of so far, was: from my archive generating view, use urllib to post to the form generating the report, save the response, and just rewrite the links to the stylesheet/JS files.
Is there a simpler way to go about this? Is there a way to keep some files on server side as long as the client's session lives?
|
Removing the panel that appears on the right hand side of OpenERP main page
| 8,149,572 | 5 | 2 | 337 | 0 |
python,openerp
|
serch for main_sidebar in web/addons/openerp/controllers/templates/form.mako
you can hide the toolbar using this css file:
web/addons/openerp/static/css/screen.cs
| 0 | 0 | 0 | 0 |
2011-11-16T08:43:00.000
| 1 | 1.2 | true | 8,148,821 | 0 | 0 | 1 | 1 |
How can we remove the panel that appears on right hand side of openERP's main page ,which shows ACTIONS ,LINKS,OTHER OPTIONS.From which file in openERP web server can we remove that.
Thanks,
Sameer
|
Removing Database name and username from top Left hand side corner.
| 12,295,904 | 0 | 0 | 133 | 1 |
python,openerp
|
It's in the openerp-web module. The location depends on your particular configuration. The relevant code can be found in the file addons/web/static/src/xml/base.xml. Search for header_title and edit the contents of the h1 tag of that class.
| 0 | 0 | 0 | 0 |
2011-11-16T11:37:00.000
| 2 | 0 | false | 8,151,033 | 0 | 0 | 1 | 1 |
How can we remove the database name and username that appears on top left hand side corner in openERP window after openERP logo.In which file do we need to make changes to remove that.
Thanks,
Sameer
|
Which simplejson module to use for Google AppEngine?
| 8,151,077 | 2 | 2 | 146 | 0 |
python,django,google-app-engine
|
Where did you see anything recommending the use of google.appengine.ext.key_range.simplejson? That is only available because the key_range package happens to import simplejson. Don't use it like that.
| 0 | 0 | 0 | 0 |
2011-11-16T11:38:00.000
| 3 | 1.2 | true | 8,151,044 | 0 | 0 | 1 | 2 |
I'm trying to figure out which simplejson module to use. Having looked back through my project I can see in some places I am using a mixture of both:
django.utils.simplejson
google.appengine.ext.key_range.simplejson
Which should I be using and why?
|
Which simplejson module to use for Google AppEngine?
| 8,151,134 | 0 | 2 | 146 | 0 |
python,django,google-app-engine
|
Functionality is probably the same for both, but I would use django.utils.simplejson, here is why:
google.appengine.ext.key_range.simplejson is not mentioned by any GAE documents so it may get removed at some point.
django.utils.simplejson has more probability to being updated along with django and it seems there is less change it will be removed in the future.
| 0 | 0 | 0 | 0 |
2011-11-16T11:38:00.000
| 3 | 0 | false | 8,151,044 | 0 | 0 | 1 | 2 |
I'm trying to figure out which simplejson module to use. Having looked back through my project I can see in some places I am using a mixture of both:
django.utils.simplejson
google.appengine.ext.key_range.simplejson
Which should I be using and why?
|
cx_Oracle 5.1.1 under apache+mod_wsgi
| 8,158,089 | 1 | 1 | 1,227 | 1 |
python,apache,cx-oracle
|
Need a solution as well.
I have the same setup on WinXP (Apache 2.2.21/ mod_wsgi 3.3/ python 2.7.2/ cx_Oracle 5.x.x). I found that cx_Oracle 5.1 also fails with the same error. Only 5.0.4 works.
Here is the list of changes that were made from 5.0.4 to 5.1:
Remove support for UNICODE mode and permit Unicode to be passed through in
everywhere a string may be passed in. This means that strings will be
passed through to Oracle using the value of the NLS_LANG environment
variable in Python 3.x as well. Doing this eliminated a bunch of problems
that were discovered by using UNICODE mode and also removed an unnecessary
restriction in Python 2.x that Unicode could not be used in connect strings
or SQL statements, for example.
Added support for creating an empty object variable via a named type, the
first step to adding full object support.
Added support for Python 3.2.
Account for lib64 used on x86_64 systems. Thanks to Alex Wood for supplying
the patch.
Clear up potential problems when calling cursor.close() ahead of the
cursor being freed by going out of scope.
Avoid compilation difficulties on AIX5 as OCIPing does not appear to be
available on that platform under Oracle 10g Release 2. Thanks to
Pierre-Yves Fontaniere for the patch.
Free temporary LOBs prior to each fetch in order to avoid leaking them.
Thanks to Uwe Hoffmann for the initial patch.
| 0 | 0 | 0 | 0 |
2011-11-16T12:36:00.000
| 1 | 0.197375 | false | 8,151,815 | 0 | 0 | 1 | 1 |
if I use cx_Oracle 5.0.4, I can connect from python console, and works under apache+django+mod_wsgi
but when I update cx_Oracle 5.1.1, I can connect from python console, BUT same code doesn't work under apache+django+mod_wsgi
File "C:\Python27\lib\site-packages\django\db\backends\oracle\base.py", line 24, in
raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
TemplateSyntaxError: Caught ImproperlyConfigured while rendering: Error loading cx_Oracle module: DLL load failed: The specified module could not be found.
PS: python 2.7
PSS: I have instaled MSVC 2008 Redistributable x86
|
Cost of Inheritance Java (Android)
| 8,153,347 | 2 | 1 | 992 | 0 |
java,android,python,performance,inheritance
|
It's the correct, and probably only, Java way. In Java all calls are virtual anyway unless you use final all over the place, but that means you couldn't even use interfaces. So most calls will probably be virtual dispatch whatever you do. Inheritance does not incur any other significant penalty.
Besides, Android devices are generally so powerful that trying to sqeeze out tiny bits of performance at the cost of readability and maintainability of the program is almost certainly not needed. In fact, most android devices are almost as powerful as web servers that do the same things in much slower PHP and still manage thousands of users while the Android device serves one.
| 0 | 0 | 0 | 1 |
2011-11-16T14:29:00.000
| 1 | 1.2 | true | 8,153,264 | 0 | 0 | 1 | 1 |
I am building an extension of ORMLite to target Android.
What I want to do
I want to reproduce one of the behavior that Doctrine and Symfony are achieving in PHP with models.
In a word:
From a yml file generate a bunch of BaseModel class with accessors
and things that won't change.
Let the real model inherits from this
BaseModel so that the user changes could persist even if they regenerate the models from the yml.
My question
I was wondering if this is good in practice to try to achieve such an objective on Android or if this will be risky in terms of performance (the heavy usage of inheritance).
If you think that it is clumsy, how can I allow the user to change the .yml file, generate the model and do no start from scratch rebuilding the customized aspects of his model.
I know this can be done by some "trick" but I really would like not to reinvent the wheel.
EDIT
Sorry, I forgot to add: I am using python to do this.
Thanks
|
Python Link Fetcher Performance Issue
| 8,156,982 | 0 | 0 | 130 | 0 |
python,beautifulsoup
|
You should consider using hashes for comparing the previously collected list. Instead of storing a list of links as strings, store a list of MD5 or SHA1 hashes for those links. Comparing a hash to a list of hashes is much faster than comparing a string to a list of strings.
Or if you maintain and persist an actual hash table of encountered links, then you wouldn't have to do any searching and comparing through a list, but would have constant time lookup to know if you've seen a link. A full hash table will cost a lot of memory if your list is big though.
| 0 | 0 | 1 | 0 |
2011-11-16T18:28:00.000
| 2 | 0 | false | 8,156,736 | 0 | 0 | 1 | 1 |
So I am writing link fetchers to find new links on particular sites for a given group of 'starting links'.
Currently I am using Python/Beautiful Soup to accomplish this with decent success.
I have an input file [for each site] that I build the 'starting links' list from.
I use urllib2 to load the webpages and then beautiful soup to find the group of links I need to fetch and append them to a list. Some sites have the links split between a lot of different pages so I have to load them all to collect the links.
After it collects all the specified type of links from each 'starting link', I then have it compare this list with a 'previously collected' list that I load from file. I then return the difference to another list which is the 'new links' list as well as add these to the 'previously collected' link list.
My problem is performance. I am recollecting all of these previously seen links each time I rerun the program which means I am reloading a bunch of pages that I am not going to get any new links from.
Generally the sites add new links on top of the others, so I am thinking my next move might be to compare the 'currently availiable' link with the 'previously collected' list and if there is not a match, then collect the link until a match occurs, where it would then drop out for this given 'starting link' and move on to the next, potentially saving a lot of page loads for sites the break up their links.
Does this make sense to help speed up the fetching of new links which I will schedule to run every few days?
The 'previously collected' list could have a couple hundred thousand links in it, so I was not sure how this would effect things to run this comparison over and over vs keeping the program dumb and always recollecting all availiable links.
Do you have a better solution all together? Any input is much appreciated.
|
Separated web server and application server?
| 8,163,446 | 3 | 2 | 265 | 0 |
python,apache,wsgi
|
WSGI is not a network protocol, so you will have to run a web server in front of your application even if it only acts as a WSGI container. Proxy connections from your main web server to the WSGI container with mod_proxy.
| 0 | 1 | 0 | 0 |
2011-11-17T07:19:00.000
| 2 | 0.291313 | false | 8,163,418 | 0 | 0 | 1 | 2 |
I am developing web service. My system is like this:
Client request --> Web Server(Apache) --> Application Server(Python)
I used WSGI for communicating between Apache and Python.
My question how can I separated the web server and app server. At the moment, I have to run them on the same server.
|
Separated web server and application server?
| 8,163,634 | 1 | 2 | 265 | 0 |
python,apache,wsgi
|
+1 for Ignacio's answer.
Also note that separating a WSGI app from a server will lose one of the main benefits of WSGI (the server calls the wsgi app directly). Additionally, WSGI apps have a response callback that was intended to communicate directly with the server.
Instead of decoupling the server from the app, have you considered keeping them paired together and replicating them over multiple servers/app pairs using nginx and/or haproxy to split and load balance requests? I believe this is the usual solution to loading issues.
| 0 | 1 | 0 | 0 |
2011-11-17T07:19:00.000
| 2 | 0.099668 | false | 8,163,418 | 0 | 0 | 1 | 2 |
I am developing web service. My system is like this:
Client request --> Web Server(Apache) --> Application Server(Python)
I used WSGI for communicating between Apache and Python.
My question how can I separated the web server and app server. At the moment, I have to run them on the same server.
|
Run the some code whenever I upload the project on to the app engine server
| 8,163,809 | 0 | 2 | 64 | 0 |
python,google-app-engine,appserver
|
There isn't an official way to discover if your application has been modified altought each time you upload your application it gets a unique version number {app version.(some unique number)} but since there isn't a document API on how to get it I wound't take a risk and use it.
What you need todo is to have a script that will upload your application and when the script is done you can call a handler in your application that set a value in the datastore that marks the application as new.
Once you have that, you can look for it in the datastore in your handlers and run the code if you find it.
| 0 | 1 | 0 | 0 |
2011-11-17T07:47:00.000
| 1 | 0 | false | 8,163,669 | 0 | 0 | 1 | 1 |
I've built an appeninge project so, how can I run some piece of code on the appserver only once, i.e when ever I upload the whole project on to the server.
How should I achieve this task???
|
How to speed up debugging of python programs in PyDev in Eclipse (esspecially Google App Engine)
| 8,169,698 | 0 | 0 | 291 | 0 |
python,debugging,google-app-engine,optimization,pydev
|
How often do you need to reload the application?, the dev server will update all your code and configuration changes without need to reload.
| 0 | 1 | 0 | 1 |
2011-11-17T15:18:00.000
| 1 | 0 | false | 8,169,561 | 0 | 0 | 1 | 1 |
How it possible to speed up debugging in PyDev in Eclipse for Google App Engine programs?
How to speed up code execution?
How to speed up application reloading?
Please share your experience or suggestions.
|
Is Sentry compatible with Mongodb?
| 8,323,585 | 3 | 3 | 1,292 | 0 |
python,django,mongodb,sentry
|
Sentry is built on a relational DB, and thus will require such for the foreseeable future. It's possible to implement most things in many NoSQL solutions, but the various types of indexes, and some of the (newer) advanced SQL would be a lot more work.
As an example, Sentry 2.0 includes a "Trending" option, which is calculated real-time, and would require writing a map/reduce query in something like MongoDB (whereas it just works everywhere else).
You can easily use the Raven client, and setup an additional Django site for the Sentry server. It's as easy as pip install django-sentry && sentry start
| 0 | 0 | 0 | 0 |
2011-11-17T22:32:00.000
| 2 | 1.2 | true | 8,175,353 | 0 | 0 | 1 | 1 |
Is Sentry (python/django) compatible with Mongodb?
If not, is there an easy solution to make it compatible?
Thanks guys.
|
Dynamic Content with a Polling Interval
| 8,175,486 | 0 | 0 | 199 | 0 |
python,html,cgi
|
I wouldn't write off the javascript polling idea.
Consider generating the file and pushing to a CDN. Make sure to let the CDN know you need a specific TTL that meets with the schedule you're generating with as their default TTL will probably be longer than 2 min. The CDN should be awesome at serving static content and dealing with a ton of requests. It should scale well.
I was just at a conference last week where the guys from Push.IO recommend this strategy for clients to appear to receive live sporting updates during a game.
| 0 | 0 | 1 | 0 |
2011-11-17T22:39:00.000
| 1 | 1.2 | true | 8,175,406 | 0 | 0 | 1 | 1 |
I plan to run a webserver with some content generated through a Python script. I have a script that generates the data I would want to present at the moment that polls every 2 minutes with a fairly large request. How can I put this data onto a webpage without making voluminous numbers of requests? I can think of a few stupid methods including writing all of my data to text files to be read by some JavaScript, but I'm looking for a better solution. Thank you.
|
Java abstract/interface design in Python
| 8,181,715 | 6 | 48 | 23,337 | 0 |
java,python,interface,abstract-class
|
I'm not that familiar with Python, but I would hazard a guess that it doesn't.
The reason why interfaces exist in Java is that they specify a contract. Something that implements java.util.List, for example, is guaranteed to have an add() method to conforms to the general behaviour as defined on the interface. You could drop in any (sane) implementation of List without knowing its specific class, call a sequence of methods defined on the interface and get the same general behaviour.
Moreover, both the developer and compiler can know that such a method exists and is callable on the object in question, even if they don't know its exact class. It's a form of polymorphism that's needed with static typing to allow different implementation classes yet still know that they're all legal.
This doesn't really make sense in Python, because it's not statically typed. You don't need to declare the class of an object, nor convince the compiler that methods you're calling on it definitely exist. "Interfaces" in a duck-typing world are as simple as invoking the method and trusting that the object can handle that message appropriately.
Note - edits from more knowledgeable Pythonistas are welcome.
| 0 | 0 | 0 | 0 |
2011-11-18T11:21:00.000
| 4 | 1 | false | 8,181,576 | 1 | 0 | 1 | 1 |
I have a number of classes which all share the same methods, only with different implementations. In Java, it would make sense to have each of these classes implement an interface or extend an abstract class. Does Python have anything similar to this, or should I be taking an alternative approach?
|
using python like php with nginx
| 10,713,125 | 1 | 1 | 3,316 | 0 |
python,nginx,php
|
You can try uwscgi. Easy to config and high performance.
| 0 | 0 | 0 | 1 |
2011-11-18T16:10:00.000
| 4 | 0.049958 | false | 8,185,374 | 0 | 0 | 1 | 1 |
We are currently using nginx as a web server along with PHP-FPM as the php application service. We have a small application which needs to be built but must use Python3. Is their a similar option to use for Python?
|
How can I delete the automatic Indexes in App Engine?
| 8,186,860 | 3 | 2 | 185 | 0 |
python,google-app-engine,google-cloud-datastore
|
vacuum_indexes is only for indexes defined in index.yaml, for automatic index its enough to set indexed = False and uploaded a new version.
You can see the impact of setting indexed to False in the development server datastore page in the write counts column.
| 0 | 1 | 0 | 0 |
2011-11-18T16:45:00.000
| 2 | 1.2 | true | 8,185,834 | 0 | 0 | 1 | 2 |
So I have a live Python application on App Engine that has far too many automatic indexes. I noticed a high amount of datastore writes for my low entity count and I believe this is the cause. Each entity has many StringProperties and some even have StringListProperties.
I added the indexed = False to all my object's properties (I don't every use a query where this would matter):
someproperty = db.StringProperty(indexed = False)
Is there anything else I need to do for new entities to be unindexed? Do I need to increment the app's version id?
Do I need to run appcfg.py vacuum_indexes . ?
|
How can I delete the automatic Indexes in App Engine?
| 8,189,761 | 1 | 2 | 185 | 0 |
python,google-app-engine,google-cloud-datastore
|
To get rid of the existing automatic indices you will have to retrieve every single entity and re-put it with the indexed = False properties.
If you don't do this, then the automatic indices will stick around. However, the new entities you create will not be added to those indices.
| 0 | 1 | 0 | 0 |
2011-11-18T16:45:00.000
| 2 | 0.099668 | false | 8,185,834 | 0 | 0 | 1 | 2 |
So I have a live Python application on App Engine that has far too many automatic indexes. I noticed a high amount of datastore writes for my low entity count and I believe this is the cause. Each entity has many StringProperties and some even have StringListProperties.
I added the indexed = False to all my object's properties (I don't every use a query where this would matter):
someproperty = db.StringProperty(indexed = False)
Is there anything else I need to do for new entities to be unindexed? Do I need to increment the app's version id?
Do I need to run appcfg.py vacuum_indexes . ?
|
e-commerce in Tornado (non-blocking) VS Flask (WSGI)
| 8,203,022 | 2 | 4 | 2,594 | 0 |
python,e-commerce,wsgi,flask,tornado
|
Not an answer but as an alternative way django with satchmo is very suitable for that sort of projects.
| 0 | 1 | 0 | 0 |
2011-11-19T21:06:00.000
| 3 | 0.132549 | false | 8,197,345 | 0 | 0 | 1 | 1 |
am trying to develop a e-commerce plateforme using python and nosql, as framework i'm between two: tornado and flask; so my question is simple:
Which one is suited for e-commerce: WSGI-like application (using Flask) or a non-blocking application (using Tornado)?
NB: the e-commerce will manage products, and users (without making chat system) but will include a notification system (like facebook one: someone -a friend- sold somthing...), so which is better for such situation?
|
Django Ldap authentication timed out
| 8,203,175 | 0 | 0 | 1,269 | 0 |
python,django,ldap,nginx
|
Active Directory does not allow anonymous binds for authorization; you can bind anonymously but you cannot do anything else.
Check if the user that is being used to bind with AD has valid credentials (ie, the account hasn't expired). If it has, you'll get these strange errors.
| 0 | 0 | 0 | 0 |
2011-11-20T11:25:00.000
| 1 | 0 | false | 8,201,185 | 0 | 0 | 1 | 1 |
I am hosting a django-based site on a local machine (I have full access/control to it).
This site authenticates users against a remote active directory via the django ldap plugin.
authenticating against LDAP server used to work!
Now, when trying to authenticate against the LDAP server, the request just hangs until it times out. I couldn’t find anything useful in the logs.
The server setup is:
NginX, Django 1.3, Fedora 15, mySql 5.1.
I don’t know what logs I should try to look at.
(I've tried looking in nginx access and error logs but to no use.)
Things I tried:
Running the site on django's and accessing it via localhost (not going through Nginx, but accessing python manage.py directly, via the runserver command). this works
Running ldapsearch from the command line. this works
edit:
i used wireshark to look at the back-and-forth with the ldap server. the interaction seems to be fine - django sends a request to bind and it receives a success msg, and then sends a search query and a user object is returned. however, after this communication django seems to hang. when i "Ctrl-c" in the django shell after running "authenticate(username=user, password=pass)", the stack trace is sitting somewhere in the django-ldap library.
Please help, I have no idea what changed that caused this problem.
Thank you in advance
|
Is it possible to serve a dynamic (with static files) web app in python as a single package with no other dependencies?
| 8,298,097 | 0 | 2 | 623 | 0 |
python,packaging,cherrypy,flask
|
Well assuming you can make your friends install python on their computer, couldn't you just do a zip file with your own code with its dependencies bundled with it, similarly to how virtualenv isolates your project's dependencies from the global ones?
If you use the builtin dev server, it would be as simple as them double clicking on the python file to boot the webserver.
| 0 | 0 | 0 | 0 |
2011-11-21T09:34:00.000
| 3 | 0 | false | 8,209,748 | 0 | 0 | 1 | 1 |
Lets say you have a friend who knows how to type python run.py according to your instructions (or double click it). Thats it. The friend doesnt know what apache or nginx is, but needs to server the web application for sharing movies/music with me and other friends.
Now you want to make a package containing your scripts which will listen on :8080 and serve the nice web application, using cherrypy for threading in case 10 or more friends access the music/blog/whatever at the same time. And the app is so simple it can be made in flask. The database is a simple sqlite3 file, nothing fancy.
Can this be done in python? Without invoking apache/nginx or configuration files or requiring the user of the web app (owner of web app, and user of it, not just oh put it on a web host somewhere for "production" use, this is not a webapp for "production", its for use by many on their own computers) to be a programmer or deployment officer.
Thanks.
'
EDIT
I went with cherrypy, just one runit.py which fired up the multithreaded server of cherrypy, with static file serving. But then I got problems with logging, from both the several apps on it and cherrypys own logging mechanism, mostly the documentation sucks.
So now, im doing it with gunicorn. A web app and a runit.py which serves it with gunicorn and gevent. Thats fine...
|
django memcahed for post form generated page
| 8,219,956 | 0 | 0 | 71 | 0 |
python,django,post,memcached
|
Short: Yes
Not so short (but vague because of a vague question): First, find a way to build a cache key from the form values. Then on form submit, create the key and look in the cache and if there is no content with that key, create, store and return it. If there is content, return that. Maybe add and expiration time.
| 0 | 0 | 0 | 0 |
2011-11-21T20:02:00.000
| 2 | 0 | false | 8,217,798 | 0 | 0 | 1 | 2 |
Is it possible to use django and memcached for dynamic page that are generated by POST form method?
The reason I'd like to do this because some of my pages are taking long time for processing while the form input from users are occasionally simillar.
|
django memcahed for post form generated page
| 8,220,837 | 0 | 0 | 71 | 0 |
python,django,post,memcached
|
Keep in mind, you also don't have to cache the entire page. One strategy we've tried at our shop is rendering expensive snippets of HTML and storing them in memcached so that they can be included dynamically.
To do that, you wouldn't do render_to_response, but you would do manual rendering with Context and the template loader.
You have to make sure you have a good expiration policy and watch for race conditions, though.
| 0 | 0 | 0 | 0 |
2011-11-21T20:02:00.000
| 2 | 0 | false | 8,217,798 | 0 | 0 | 1 | 2 |
Is it possible to use django and memcached for dynamic page that are generated by POST form method?
The reason I'd like to do this because some of my pages are taking long time for processing while the form input from users are occasionally simillar.
|
Advice: Python Framework Server/Worker Queue management (not Website)
| 8,220,985 | 0 | 0 | 552 | 0 |
python,message-queue,rabbitmq,worker
|
How about using pyro? It gives you remote object capability and you just need a client script to coordinate the work.
| 0 | 1 | 0 | 0 |
2011-11-21T22:22:00.000
| 1 | 0 | false | 8,219,355 | 0 | 0 | 1 | 1 |
I am looking for some advice/opinions of which Python Framework to use in an implementation of multiple 'Worker' PCs co-ordinated from a central Queue Manager.
For completeness, the 'Worker' PCs will be running Audio Conversion routines (which I do not need advice on, and have standalone code that works).
The Audio conversion takes a long time, and I need to co-ordinate an arbitrary number of the 'Workers' from a central location, handing them conversion tasks (such as where to get the source files, or where to ask for the job configuration) with them reporting back some additional info, such as the runtime of the converted audio etc.
At present, I have a script that makes a webservice call to get the 'configuration' for a conversion task, based on source files located on the worker already (we manually copy the source files to the worker, and that triggers a conversion routine). I want to change this, so that we can distribute conversion tasks ("Oy you, process this: xxx") based on availability, and in an ideal world, based on pending tasks too.
There is a chance that Workers can go offline mid-conversion (but this is not likely).
All the workers are Windows based, the co-ordinator can be WIndows or Linux.
I have (in my initial searches) come across the following - and I know that some are cross-dependent:
Celery (with RabbitMQ)
Twisted
Django
Using a framework, rather than home-brewing, seems to make more sense to me right now. I have a limited timeframe in which to develop this functional extension.
An additional consideration would be using a Framework that is compatible with PyQT/PySide so that I can write a simple UI to display Queue status etc.
I appreciate that the specifics above are a little vague, and I hope that someone can offer me a pointer or two.
Again: I am looking for general advice on which Python framework to investigate further, for developing a Server/Worker 'Queue management' solution, for non-web activities (this is why DJango didn't seem the right fit).
|
Average PHP developer wanting to move to Python+Django : Directly go with Django or learn the MVC Framework stuff in PHP first?
| 8,221,221 | 1 | 1 | 789 | 0 |
php,python,django,cakephp,frameworks
|
Well, here's some info that may help along the way:
Don't categorize everything that has routes, controllers, views, etc as "MVC". Django, for example, is self-described as MTV.
Django is a fantastic framework and does lots of things well. You will find that the Django and Python library and community is much more "batteries included" than PHP's.
Pigeonholing yourself into one language or framework is almost always a bad idea. You don't have to leave PHP, Ruby, etc forever in order to learn Django and Python. Accumulate and assimilate and you'll be more valuable.
Just go read the Django documentation end to end and follow the tutorial. It'll take a few days of your time, but you'll save yourself weeks of writing code that someone else has already baked into the framework or Python.
| 0 | 0 | 0 | 0 |
2011-11-22T02:02:00.000
| 2 | 0.099668 | false | 8,221,077 | 0 | 0 | 1 | 2 |
As a student in web development, I work with PHP, mainly through CMSs.
I already know the basic knowledge on the famous MVC design pattern, but now would like to work with a framework.
I've just discovered RoR and Django (respectively Ruby & Python Frameworks) and my first experiments with these frameworks, coupled to the amazing syntaxes of their languages, completely blown me away.
I've already made my choice: Django. (Just to explain : Throughout my researches, I learnt that Django's philosophy is : "There should be one-- and preferably only one --obvious way to do it.", and that RoR's motto was exactly the opposite. As a noobie, I think it would be better to work on an app that naturally leads me to the best practices. I can also add that Django seems to be far more transparent and easier to understand, compared to the weird "magic" of Ruby).
The problem is that learning the language and the Framework will may be a difficult task.
My objectives are:
- Mastering Python + Django.
- Learn the right way to develop MVC applications.
- Become productive as fast as possible.
And considering that Django and Cake PHP are quite "similar", should I first learn "MVC in the real world" with Cake PHP before trying to begin directly with Python + Django or not? What would you do, according to your experience?
Pros for learning Cake Php first:
Some of my friends already work with Cake and they could help.
Learning something new is always a nice line to add on the CV.
Cons:
Learning something new is always a bit stupid when you are 95% convinced you won't use it anymore in the future.
|
Average PHP developer wanting to move to Python+Django : Directly go with Django or learn the MVC Framework stuff in PHP first?
| 8,221,162 | 3 | 1 | 789 | 0 |
php,python,django,cakephp,frameworks
|
The shortest path to Python/Django is to learn Python/Django.
If you invest time in learning something different, it will just create some preconceptions that may not hold in a Python/Django environment.
| 0 | 0 | 0 | 0 |
2011-11-22T02:02:00.000
| 2 | 1.2 | true | 8,221,077 | 0 | 0 | 1 | 2 |
As a student in web development, I work with PHP, mainly through CMSs.
I already know the basic knowledge on the famous MVC design pattern, but now would like to work with a framework.
I've just discovered RoR and Django (respectively Ruby & Python Frameworks) and my first experiments with these frameworks, coupled to the amazing syntaxes of their languages, completely blown me away.
I've already made my choice: Django. (Just to explain : Throughout my researches, I learnt that Django's philosophy is : "There should be one-- and preferably only one --obvious way to do it.", and that RoR's motto was exactly the opposite. As a noobie, I think it would be better to work on an app that naturally leads me to the best practices. I can also add that Django seems to be far more transparent and easier to understand, compared to the weird "magic" of Ruby).
The problem is that learning the language and the Framework will may be a difficult task.
My objectives are:
- Mastering Python + Django.
- Learn the right way to develop MVC applications.
- Become productive as fast as possible.
And considering that Django and Cake PHP are quite "similar", should I first learn "MVC in the real world" with Cake PHP before trying to begin directly with Python + Django or not? What would you do, according to your experience?
Pros for learning Cake Php first:
Some of my friends already work with Cake and they could help.
Learning something new is always a nice line to add on the CV.
Cons:
Learning something new is always a bit stupid when you are 95% convinced you won't use it anymore in the future.
|
Debug PyDev+Eclipse - Code not reloads after code change in breakpoint/suspend mode
| 8,224,704 | 5 | 5 | 886 | 0 |
python,debugging,google-app-engine,pydev
|
The way the debug works is not by executing the source line-by-line. The debug "compiles" your source to bytecode (the .pyc files) and execute those, not your source.
The debug only keeps track of what piece of the .pyc files correspond to what line of your .py ones and display that information for your convenience, but the .py file itself is not what the debugger is using to run the program.
Therefore, if you change the source / .py file and want the debugger to acknowledge those changes, you need to "recompile" the .pyc files first.
HTH!
| 0 | 1 | 0 | 0 |
2011-11-22T09:33:00.000
| 1 | 1.2 | true | 8,224,592 | 0 | 0 | 1 | 1 |
I often doing such steps and want to optimize debug speed:
I am setting some breakpoints.
I am running Google Appengine Application (Python 2.5.2+).
When breakpoint occur I often change code to fix bugs.
After code change want to test again but there is problem if I changed code in breakpoint/suspend mode the application does not updates with my code changes - thus requiring a slow reloading.
Does anybody have an idea of what is root cause of forcing reloading after suspend or it is PyDev Bug/Limitation?
|
Accessing Django Runserver on Shared Hosting
| 8,252,044 | 0 | 3 | 5,897 | 0 |
python,django,django-admin,timeout,shared-hosting
|
First, a webserver typically has at least two "interfaces", each with one or more IPs. The "loopback" interface will have the IP 127.0.0.1, and is ONLY accessible from the machine running the server.
So, running on 127.0.0.1:8000 means that you are telling runserver to be accessible ONLY from that server itself, on port 8000. That's secure, but a little rough for testing. In order to see the result in a web browser you would need to use an SSH tunnel with port forwarding. (I'd explain how to do that, but honestly, it won't solve your real issue. But I'll come back to that.)
Running on :8000 means that you are telling runserver to be accessible from the internet - which is probably what you want. If that's not working, then it probably means they're firewalling the port. You could contact support and ask them to open a hole, OR use an SSH tunnel, but at this point I have to ask: What are you trying to achieve?
You shouldn't use runserver for production. Use runserver on your local machine for testing, then deploy to Hostmonster. (Apparently they support Django via FastCGI, according to their website.) Don't use runserver on Hostmonster, it won't do what you want.
| 0 | 0 | 0 | 0 |
2011-11-24T00:27:00.000
| 4 | 0 | false | 8,250,936 | 0 | 0 | 1 | 2 |
I'm developing a Django application on a shared hosting service (hostmonster) and am, of course, unable to access the runserver on the default localhost ip of 127.0.0.1:8000 over Firefox. The Django Project site's documentation details how to set up remote access to the run-server, but I'm not having any success with that. Setting the runserver to 0.0.0.0:8000 leaves it inaccessible. Though I figured it wouldn't work, I tried to configure the runserver to my home ip address. That gave me a "That IP address can't be assigned-to" error, as I'd expected.
So, I tried configuring it to my hosted IP, the one through which I SSH in the first place. That set up properly, but still was unable to access the address via Firefox. When I plug in the IP address on its own, I just get a hostmonster error page. When I affix the port number, the connection times out. When I plug in the IP, port number and the /admin to access the Django admin page I've created, I also time out.
|
Accessing Django Runserver on Shared Hosting
| 8,252,018 | 0 | 3 | 5,897 | 0 |
python,django,django-admin,timeout,shared-hosting
|
I'm betting that port 8000 is blocked. That explains the timeouts you mention in the last couple sentences: the firewall is set to simply drop the packets and not return any connection refusal responses.
You're going to have to ask your hosting company if there's a way around this, but there might not be one. At the least, they'll have to open a non-root port (8000 or something else over 1023), but the OS can't tell when it's you opening the port or something else, so it'll be a potential security hole (e.g. an intruder can set up something to listen for commands on that port, just like you are).
runserver wasn't really designed to be run on the production box. It's designed to be run on your development machine, with a small test database or something. This lets you get most of the bugs out. Then you push your code to a beta server, configured with the real server apps (e.g. apache on port 80) and databases and such, to do the heavy testing (make sure there's a filter for what IPs can connect, at least). Then you push to production from there. Or not; there are lots of ways to do this.
| 0 | 0 | 0 | 0 |
2011-11-24T00:27:00.000
| 4 | 0 | false | 8,250,936 | 0 | 0 | 1 | 2 |
I'm developing a Django application on a shared hosting service (hostmonster) and am, of course, unable to access the runserver on the default localhost ip of 127.0.0.1:8000 over Firefox. The Django Project site's documentation details how to set up remote access to the run-server, but I'm not having any success with that. Setting the runserver to 0.0.0.0:8000 leaves it inaccessible. Though I figured it wouldn't work, I tried to configure the runserver to my home ip address. That gave me a "That IP address can't be assigned-to" error, as I'd expected.
So, I tried configuring it to my hosted IP, the one through which I SSH in the first place. That set up properly, but still was unable to access the address via Firefox. When I plug in the IP address on its own, I just get a hostmonster error page. When I affix the port number, the connection times out. When I plug in the IP, port number and the /admin to access the Django admin page I've created, I also time out.
|
Django design patterns - models with ForeignKey references to multiple classes
| 8,515,995 | 0 | 0 | 235 | 0 |
python,django,django-models
|
I think its perfectly reasonable to create a "through" table such as location, which associates an asset, a content (foreign key) and a content_type (warehouse or shipment) . And you could set a unique constraint on the asset_fk so thatt it can only exist in one location at a time
| 0 | 0 | 0 | 0 |
2011-11-25T22:07:00.000
| 2 | 0 | false | 8,274,664 | 0 | 0 | 1 | 2 |
I'm working through the design of a Django inventory tracking application, and have hit a snag in the model layout. I have a list of inventoried objects (Assets), which can either exist in a Warehouse or in a Shipment. I want to store different lists of attributes for the two types of locations, e.g.:
For Warehouses, I want to store the address, manager, etc.
For Shipments, I want to store the carrier, tracking number, etc.
Since each Warehouse and Shipment can contain multiple Assets, but each Asset can only be in one place at a time, adding a ForeignKey relationship to the Asset model seems like the way to go. However, since Warehouse and Shipment objects have different data models, I'm not certain how to best do this.
One obvious (and somewhat ugly) solution is to create a Location model which includes all of the Shipment and Warehouse attributes and an is_warehouse Boolean attribute, but this strikes me as a bit of a kludge. Are there any cleaner approaches to solving this sort of problem (Or are there any non-Django Python libraries which might be better suited to the problem?)
|
Django design patterns - models with ForeignKey references to multiple classes
| 8,515,865 | 1 | 0 | 235 | 0 |
python,django,django-models
|
what about having a generic foreign key on Assets?
| 0 | 0 | 0 | 0 |
2011-11-25T22:07:00.000
| 2 | 1.2 | true | 8,274,664 | 0 | 0 | 1 | 2 |
I'm working through the design of a Django inventory tracking application, and have hit a snag in the model layout. I have a list of inventoried objects (Assets), which can either exist in a Warehouse or in a Shipment. I want to store different lists of attributes for the two types of locations, e.g.:
For Warehouses, I want to store the address, manager, etc.
For Shipments, I want to store the carrier, tracking number, etc.
Since each Warehouse and Shipment can contain multiple Assets, but each Asset can only be in one place at a time, adding a ForeignKey relationship to the Asset model seems like the way to go. However, since Warehouse and Shipment objects have different data models, I'm not certain how to best do this.
One obvious (and somewhat ugly) solution is to create a Location model which includes all of the Shipment and Warehouse attributes and an is_warehouse Boolean attribute, but this strikes me as a bit of a kludge. Are there any cleaner approaches to solving this sort of problem (Or are there any non-Django Python libraries which might be better suited to the problem?)
|
Migrate a legacy DB to Django, with image files
| 8,280,938 | 0 | 1 | 438 | 1 |
python,django,data-migration,filefield
|
One approach would be to create a utility django project specifying your legacy database in settings.py. Then use the inspectdb management command to create a django model representation of your legacy database. And finally use dumpdata to get you data in JSON format.
You could then finally make your own JSON script that inserts your old data in your new models.
| 0 | 0 | 0 | 0 |
2011-11-26T19:05:00.000
| 1 | 0 | false | 8,280,859 | 0 | 0 | 1 | 1 |
I have a SQL dump of a legacy DB, and a folder with images, and those are referenced by some rows of certain tables, and I need to migrate that data to the new Django models. The specific problem is how to "perform" the upload, but in a management command.
When the table with the field referenced is migrated to it's corresponding model, I need to also set the image field of the model, and I also need to process the filename accordingly to the upload_to parameter for the ImageField.
How to programmatically populate the image field from a file path or a file descriptor?
|
Google App Engine handling parallel requests
| 8,282,420 | 2 | 0 | 210 | 0 |
python,google-app-engine,webserver,parallel-processing
|
The Python dev_appserver is single-threaded and only serves one request at a time. The production environment, naturally, has no such restriction.
| 0 | 1 | 0 | 0 |
2011-11-26T20:58:00.000
| 1 | 1.2 | true | 8,281,565 | 0 | 0 | 1 | 1 |
I am using Google App Engine for the first time, whenever I make requests using two instances of the application, the responses come sequentially..
For example, I opened two pages of the app's main page, made an AJAX request from one then refreshed the other, the page doesn't load until the first page gets its response.. so the server actually waits and responds to requests sequentially..
Is this an issue with the development server only? or am I missing something here?
|
Django manage.py localization
| 8,287,296 | 2 | 1 | 114 | 0 |
python,django
|
It depends on who are you working with. Personally I prefer having output of developer's stuff in english, even though it is not my native language. I think that anyone who is a professional developer has some grasp of english, and the fact is that it is much easier to find potential errors posted in english than in any other language (especially if you'd translate it your way, that sometimes may involve some uncommon expressions etc.). As far as I know Django manage.py does the stuff that only developers might be intrested in, so don't complicate their lives and leave it without localization. But it is my opinion, I think that you should ask your team members about their preferences.
| 0 | 0 | 0 | 0 |
2011-11-27T16:24:00.000
| 1 | 0.379949 | false | 8,287,017 | 0 | 0 | 1 | 1 |
It is comfortable for somebody to read messages on native language. Is it a good idea to add localization for output of manage.py in Django?
|
Python 2.7 32-bit install on Win 7: No registry keys?
| 8,290,228 | 7 | 6 | 4,206 | 0 |
python,windows,registry,installation
|
32-bit applications installed on 64-bit OSes store their registry values in:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node. If you look there, you should see the settings you are looking for.
| 0 | 0 | 0 | 0 |
2011-11-27T23:09:00.000
| 1 | 1.2 | true | 8,289,859 | 1 | 0 | 1 | 1 |
I have downloaded the Python 2.7.2 Windows x86 32-bit MSI from python.org and installed it on a 64-bit Windows 7 system. Everything works (at least the command-line interpreter starts and runs), but the install process does not create any Python entries under HKEY_LOCAL_MACHINE/SOFTWARE in the Windows registry.
Various blogs refer to problems created by incomplete Python registry entries when attempting to configure third-party libraries, but I have not found a description of the complete absence of a Python entry in the registry.
I plan to use Python only with the Google Apps Engine SDK and (hopefully) django-nonrel for some fairly simple Google Apps projects. The absence of a Python registry key may not even be an issue for me, but the Django setup docs assume its existence and suggest adding path information to it as a way to populate Python's sys.path list.
Anyone else run into this? Is an additional install step necessary to create the key? Should I manually create it using regedit? Is it even needed, or can the PATH and/or PYTHONPATH environment variables be used for everything instead?
|
Image in the HTML email message
| 8,301,559 | 1 | 0 | 431 | 0 |
python,html,mime-types,sendmail,mime-message
|
You need to write src="cid:ContentId" to refer to an attached image, where ContentId is the ID of the MIME part.
| 0 | 0 | 1 | 1 |
2011-11-28T19:53:00.000
| 2 | 0.099668 | false | 8,301,501 | 0 | 0 | 1 | 2 |
I am working with a Python function that sends mails wich include an attachment and a HTML message......I want to add an image on the HTML message using
<img src="XXXX">
When I try it, the message respects the tag, but does not display the image I want (it displays the not found image "X").....
does anyone know if this is a problem with the MIME thing....because i am using the MIMEMultipart('Mixed').....
or it is a problem with the path of the image (I'm using the same path for the atachment file and there is no problem with it)....
I dont know what else could it be!!
thanks a lot!!
|
Image in the HTML email message
| 8,301,539 | 1 | 0 | 431 | 0 |
python,html,mime-types,sendmail,mime-message
|
In your html you need the fully qualified path to the image: http://yourdomain.com/images/image.jpg
You should be able to take the URL in the image tag, paste it into the browser's address bar and view it there. If you can't see it, you've got the wrong path.
| 0 | 0 | 1 | 1 |
2011-11-28T19:53:00.000
| 2 | 1.2 | true | 8,301,501 | 0 | 0 | 1 | 2 |
I am working with a Python function that sends mails wich include an attachment and a HTML message......I want to add an image on the HTML message using
<img src="XXXX">
When I try it, the message respects the tag, but does not display the image I want (it displays the not found image "X").....
does anyone know if this is a problem with the MIME thing....because i am using the MIMEMultipart('Mixed').....
or it is a problem with the path of the image (I'm using the same path for the atachment file and there is no problem with it)....
I dont know what else could it be!!
thanks a lot!!
|
phonetic spelling in Python and Java
| 8,546,969 | 1 | 8 | 5,615 | 0 |
java,python,text-processing,text-mining,spelling
|
Are you looking for something akin to the international phonetic alphabet (IPA) or some other phonetic output? If ARPAbet is ok, there is the CMU pronouncing dictionary (http://www.speech.cs.cmu.edu/cgi-bin/cmudict). That'll give the ARPAbet rendering of most words in English. I've written some code that converts the ARPAbet spelling to IPA and post to github if you'd like.
| 0 | 0 | 0 | 1 |
2011-11-28T21:26:00.000
| 4 | 0.049958 | false | 8,302,553 | 0 | 0 | 1 | 1 |
I am trying to build a system that accepts text and outputs the phonetic spelling of the words of this text. Any ideas on what libraries can be used in Python and Java?
|
Corba python integration with web service java
| 8,310,341 | 4 | 0 | 375 | 0 |
java,python,web-services,corba
|
You will need a Java CORBA provider - for example IONA or JacORB. Generate the IDL files for your python service and then use whatever IDL -> stub compiler your Java ORB provides to generate the java client-side bindings.
From there it should be as simple as binding to the corbaloc:// at which your python server is running and executing the remote calls from your java stubs.
Of course, CORBA being CORBA, it is likely to require the ritual sacrifice of small mammals and, possibly, lots of candles.
| 0 | 0 | 1 | 0 |
2011-11-29T11:55:00.000
| 1 | 0.664037 | false | 8,310,262 | 0 | 0 | 1 | 1 |
i'm working on a project thata i need develop one web service ( in java ) that get one simple number from a Corba python implementation... how can i proceed with this??
im using omniOrb and already done the server.py that genetares one simple number!
thx a lot
|
Print HTML text of a selenium webelement in Python
| 8,316,622 | 12 | 6 | 7,324 | 0 |
python,selenium,beautifulsoup,web-scraping,urllib2
|
It's not possible to get the raw HTML from a WebElement.
You can get the page source from the browser object though: browser.page_source.
| 0 | 0 | 1 | 0 |
2011-11-29T18:54:00.000
| 1 | 1.2 | true | 8,316,152 | 0 | 0 | 1 | 1 |
I am using Selenium webdriver in Python for a web-scraping project.
How to print the HTML text of the selenium.WebElement ?
I intend to use the BeautifulSoup to parse the HTML to extract the data of interest.
Thanks
|
django manage.py settings default
| 8,318,788 | 1 | 15 | 12,459 | 0 |
python,django
|
You can use django-admin.py with that environment variable. Commands are interchangeable, only django-admin.py doesn't override the variable you're trying to use.
| 0 | 0 | 0 | 0 |
2011-11-29T22:31:00.000
| 5 | 0.039979 | false | 8,318,688 | 0 | 0 | 1 | 1 |
I have a settings.py file and a dev_settings.py file that I use to override some values for dev purposes. Everytime I run the ./manage.py command, I have to specify --settings=whatever.local_settings. This becomes very tedious to do every time and I am trying to find a way to force manage.py to load my dev_settings.py file every by default so that I don't have to type that long argument every time I want to run a command.
I have tried setting DJANGO_SETTINGS_MODULE, however, it appears that manage.py overrides this option.
Is it possible to make this happen or am I doomed to always specify that argument?
|
Django. Business Logic Bottlenecks.
| 8,328,308 | 0 | 0 | 562 | 0 |
python,django,performance,views
|
Do you use the django debug toolbar ? You could find what queries are run with it, middleware or not.
How do you monitor the performance of the view ?
Are there much more users in the big project than in the fresh one ?
| 0 | 0 | 0 | 0 |
2011-11-30T14:16:00.000
| 4 | 0 | false | 8,327,300 | 0 | 0 | 1 | 1 |
Is there any smart way to find bottlenecks in business logic. For example, we have application, that have one view that doing HttpResponse('1') in big project. We are sure, that no SQL queries in middlewares exists. But HttpResponse working really slow(50 rps vs 200 rps on clear django project).
What reasons can be?
How to find bottlenecks in this case?
Also we know, that in clear project less than 1 Mb of memory used for objects on each request, and in our project - more than 2Mb. How to find these objects?
|
how to password protect a website hosted on gunicorn
| 8,342,278 | 1 | 4 | 3,648 | 0 |
python,django,gunicorn
|
You can also use middleware and for example kill every session and show nothing if it not passes the requirements. For example, you can define middleware which checks if the request comes from the IP you use, if yes - do nothing, if no - stop. Maybe not the best, but solution :)
| 0 | 0 | 0 | 1 |
2011-12-01T12:59:00.000
| 2 | 0.099668 | false | 8,341,797 | 0 | 0 | 1 | 1 |
Is there a way to password protect an application which is hosted in gunicorn,
I did this with .htaccess in apache, but can we do this in gurnicorn?
|
Architecture: I have to make available object properties that that is updated every couple seconds
| 8,348,956 | 0 | 1 | 62 | 0 |
python,twisted
|
I think either you create an selfCreatedObject or using a memcached once, it will be an instance of python objects, like list or dict or anything else so the two ways are to same destination.
I prefer to use object so you can make a check the change of the object value or validate it if needed.
| 0 | 1 | 0 | 0 |
2011-12-01T21:41:00.000
| 2 | 0 | false | 8,348,687 | 0 | 0 | 1 | 2 |
My app maintains the state of a bunch of objects with variables.
I'm using Twisted to accept socket requests and return the properties of an object.
I want to make sure the app can scale for a lot of requests so I'm wondering if I should deliver the object properties directly from the objects, or if I should store those properties in memcached or something similar, and have the requests read from that store.
I just wasn't sure if lots of requests reading the same object values would affect the performance of the part of the app that is managing those objects.
Am I over thinking it?
|
Architecture: I have to make available object properties that that is updated every couple seconds
| 8,348,947 | 0 | 1 | 62 | 0 |
python,twisted
|
I don't think you have any performance penalty because of having many reading operations from the same object (only one thread is executed at a time after all).
| 0 | 1 | 0 | 0 |
2011-12-01T21:41:00.000
| 2 | 0 | false | 8,348,687 | 0 | 0 | 1 | 2 |
My app maintains the state of a bunch of objects with variables.
I'm using Twisted to accept socket requests and return the properties of an object.
I want to make sure the app can scale for a lot of requests so I'm wondering if I should deliver the object properties directly from the objects, or if I should store those properties in memcached or something similar, and have the requests read from that store.
I just wasn't sure if lots of requests reading the same object values would affect the performance of the part of the app that is managing those objects.
Am I over thinking it?
|
Eclipse & Python: 100% CPU load due to PythonHome reindexing
| 10,102,742 | 1 | 0 | 706 | 0 |
python,eclipse,cpu,pydev
|
Disable 'Build Automatically' and 'Refresh Automatically' under
Preferences->General->Workspace
Disable 'Code Analysis' entirely, or configure it to only run on save under
Preferences->PyDev->Editor->Code Analysis
| 0 | 1 | 0 | 1 |
2011-12-02T16:17:00.000
| 2 | 0.099668 | false | 8,359,291 | 0 | 0 | 1 | 1 |
I am currently switching from Eclipse Java Development more and more Python scripting using PyDev. Almost all the time there is a Eclipse backgropund thread called "reindexing PythonHome..." which loads my CPU for almost 100%. Unusable to coding in there anymore :/
Do you have any idea?
Thanks a lot for your help!
John
|
Highlighting glossary terms inside a HTML document
| 8,366,996 | -1 | 1 | 689 | 0 |
javascript,python,highlighting,glossary,glossaries
|
How about going through each term in the glossary and then, for each term, using regex to find all occurrences in the HTML? You could replace each of those occurrences with the term wrapped in a span with a class "highlighted" that will be styled to have a background color.
| 0 | 0 | 1 | 0 |
2011-12-03T09:59:00.000
| 3 | -0.066568 | false | 8,366,909 | 0 | 0 | 1 | 1 |
We have a glossary with up to 2000 terms (where each glossary term may
consist of one, two or three words (either separated with whitespaces
or a dash).
Now we are looking for a solution for highlighting all terms inside a
(longer) HTML document (up to 100 KB of HTML markup) in order to
generate a static HTML page with the highlighted terms.
The constraints for a working solution are: large number of glossary terms
and long HTML documents...what would be the blueprint for an efficient solution
(within Python).
Right now I am thinking about parsing the HTML document using lxml, iterating over all text nodes and then matching the contents within each text node against all glossary terms.
Client-side (browser) highlighting on the fly is not an option since IE will complain about long running scripts with a script timeout...so unusable for production use.
Any better idea?
|
Filtering GMail messages in Google App Engine application
| 8,373,562 | 0 | 3 | 487 | 0 |
python,django,google-app-engine,gmail
|
What do you mean by "fully connected"?
It's possible to set up a GMail filter to forward emails to a different address (say, the email address of your App Engine app). And an App Engine app an send emails (say, to a GMail address). The trick is to set up the GMail filter carefully to avoid loops.
| 0 | 1 | 0 | 1 |
2011-12-03T11:39:00.000
| 2 | 1.2 | true | 8,367,381 | 0 | 0 | 1 | 2 |
I would like to build an application in Google App Engine (Python) that would be fully connected to a single GMail account and then filter e-mails from this account (e.g. filter messages for a certain string and show it on the string). In the future I am also going to implement the option to send messages.
What is the most efficient way to do this (solution provided by Google if possible)?
|
Filtering GMail messages in Google App Engine application
| 8,379,161 | 0 | 3 | 487 | 0 |
python,django,google-app-engine,gmail
|
There is no Api for Gmail in App Engine. The only thing you can do is forwarding messages to App Engine.
I have used fowarding for building auto responders.
But there is an excellent GMail Api in Google Apps Script with lots of functions. Apps scrips uses javascript. And ofcourse your apps script can communicate with App Engine.
| 0 | 1 | 0 | 1 |
2011-12-03T11:39:00.000
| 2 | 0 | false | 8,367,381 | 0 | 0 | 1 | 2 |
I would like to build an application in Google App Engine (Python) that would be fully connected to a single GMail account and then filter e-mails from this account (e.g. filter messages for a certain string and show it on the string). In the future I am also going to implement the option to send messages.
What is the most efficient way to do this (solution provided by Google if possible)?
|
python po box split for auth.net
| 8,725,779 | 0 | 1 | 422 | 0 |
python,regex
|
The regular expression '(P[\.\s]*O[\.\s]*Box)?\s*(\d+)\s*(P[\.\s]*O[\.\s]*Box)?' will match almost anything that looks like a PO Box (but will match a number only address too). The replacement '\2 PO Box' would normalize the data.
So the code would be something like this
import re
rgx = re.compile(r'(P[\.\s]*O[\.\s]*Box)?\s*(\d+)\s*(P[\.\s]*O[\.\s]*Box)?')
addrs = ('PO Box 001', 'P.O. Box 002', 'P.O.Box 003', '004 P.O. Box', '005 PO Box', '006')
for addr in addrs:
print rgx.sub(r'\2 PO Box', addr)
| 0 | 0 | 0 | 0 |
2011-12-03T19:00:00.000
| 1 | 0 | false | 8,370,147 | 1 | 0 | 1 | 1 |
Authorize.net ( or the banks ) will not validate an address unless for a PO Box address, unless its in the form of 123 P.O. Box. Most people use P.O Box 123. There are loads of variations PO Box formats and I need an algorithm that puts the number in front of the PO Box
Any suggests would be helpful.
|
Google App Engine and win32 DDE
| 8,405,511 | 1 | 1 | 367 | 0 |
python,google-app-engine,pywin32,dde
|
The problem was not on the GAE development server: I managed to uninstall the win32 python build 216 library and install a previous version. The problem was indeed with the manifest of the build 216 and not with the GAE development server. Now it works fine with build 214.
| 0 | 1 | 0 | 0 |
2011-12-05T10:40:00.000
| 1 | 0.197375 | false | 8,384,052 | 0 | 0 | 1 | 1 |
I'm trying to set up a little server through the App Engine Python development server:
GOAL:
On Windows I've got a DDE application.
I need to read data from this application and serve it over the Internet.
SITUATION:
The development server is working correctly on port 80, enabling me to store data and make it available as JSON over the Internet.
PROBLEM:
I cannot get the development server to work correctly with the win32 Python library.
I enabled the module in the local whitelist, but still when trying to start a DDE connection it says:
This must be an MFC application - try loading win32ui first
args = ('This must be an MFC application - try loading win32ui first',)
message = 'This must be an MFC application - try loading win32ui first'
I have got no idea on what to do. Any hint will be very much appreciated.
|
Conditional formatting using ruby or python
| 8,778,840 | 1 | 0 | 428 | 0 |
python,ruby,google-sheets
|
This is not currently possible, Google does not let python or ruby runs in the browser. Conditional formatting is currently limited to simple rules based on cell contents. Google has recently rolled macros ability in their spreadsheets but that is limited to JavaScript and does not support conditional formatting.
| 0 | 0 | 0 | 0 |
2011-12-06T07:20:00.000
| 1 | 1.2 | true | 8,396,511 | 0 | 0 | 1 | 1 |
Does anybody know how to apply conditional formatting to a google spreadsheet document using ruby or python?
|
Error in PIL installed with PIP - Django,Python
| 8,402,859 | 1 | 3 | 4,607 | 0 |
python,django,macos,python-imaging-library,pip
|
My fix for this is to make sure you have packages libjpeg-dev and libpng-dev installed before doing the pip install of PIL.
sudo apt-get install libjpeg-dev libpng-dev
will probably do. Then pip gets PIL from source, compiles with jpeg and png support.
| 0 | 0 | 0 | 0 |
2011-12-06T13:59:00.000
| 4 | 0.049958 | false | 8,401,085 | 1 | 0 | 1 | 1 |
I installed PIL using PIP. However, using PIL on Django, when trying to upload a .jpg file, I get the error:
Upload a valid image. The file you uploaded was either not an image or a corrupted image.
I read on the Internet about this error and a solution was to delete the compiled files for the current OS, then use setup.py again.
However, as I installed PIL with PIP, I have no setup.py and no folder with files compiled for my particular OS. This is Mac OSX Lion.
Update: I did not have libjpeg installed on my computer. I have it now and I am trying to change the PIL configuration to point to the libjpeg library.
|
Installing PIL with JPEG support on Mac OS X
| 8,409,103 | 3 | 37 | 36,574 | 0 |
python,django,python-imaging-library,libjpeg
|
Worth noting and good information to have whenever working with Python and PIL: If you use virtualenv (and I think it's a very good idea), PIL may not correctly detect the image libraries on your system and install without JPEG/PNG support. Use the pillow package for a compatible PIL fork that finds them correctly.
| 0 | 0 | 0 | 0 |
2011-12-06T18:34:00.000
| 7 | 0.085505 | false | 8,404,956 | 1 | 0 | 1 | 1 |
I posted a question before regarding this subject, and read other ones posted before, but none has successfully solved my problem.
I am trying to install PIL on Mac OS X Lion, as I need it for a Django application. I also need JPEG support, so I need a JPEG decoder as well.
I have tried to download the libjpeg sources and compile them, and install PIL, but it doesn't recognize the directory.
So what I would like, and I believe this exists somewhere, is a method to install both PIL and libjpeg with a package installer, without the need for any compilation whatsoever!
Thank you in advance for every reply.
|
Passing form parameters between views in Pyramid
| 8,409,714 | 5 | 2 | 921 | 0 |
python,forms,pyramid
|
This is not a Pyramid-specific answer, but two common approaches to this problem are:
Store the data in a session.
Store the data as a hidden form on the confirmation page, and resubmit with "confirmed"
I like 2 much better because it's a stateless method. You can also use the exact same form processing logic, and just check for the presence of your "confirmed" POST variable to decide which action to take and view to show (i.e, either the "please confirm" view, or processing and the "processed" view.)
| 0 | 0 | 0 | 0 |
2011-12-07T02:02:00.000
| 1 | 1.2 | true | 8,409,521 | 0 | 0 | 1 | 1 |
I am creating a form that requires user confirmation before submitting the data. I would like a seperate confirmation page because I need to display quite a bit information about how the form data will be processed. I was wondering if there was a pythonic way to pass data between forms in Pyramid.
Submitting the form takes the user to the confirmation page. Thus, the view for the confirmation has the form data stored in request.POST. I was wondering if there was a clean way to pass along all of this data to the final view once the user hits 'submit' on the confirmation page. I would also like to add a boolean variable, confirmed, to the dictionary of parameters.
|
Python/Javascript: WYSIWYG html editor - Handle large documents fast and/or design theory
| 8,413,073 | 1 | 2 | 1,587 | 0 |
python,html,wysiwyg
|
Can i suggest a complete another approach ? Since your ebook is only <p></p>:
Split the text on <p></p> to get an indexed array of all your paragraphs
Make your own pagination system, and fill the screen with N paragraphs, that automatically get enough text to show from the indexed array
When you are doing selection, you can use [paragraph index + character index in the paragraph] for selection start / end
Then implement cut/copy/paste/delete/undo/redo based on thoses assumptions.
(Note: when you'll do a selection, since the start point is saved, you can safely change the text on the screen / pagination, until the selection end.)
| 1 | 0 | 0 | 1 |
2011-12-07T08:17:00.000
| 1 | 0.197375 | false | 8,412,215 | 0 | 0 | 1 | 1 |
Background:
I am writing an ebook editing program in python. Currently it utilizes a source-code view for editing, and I would like to port it over to a wysiwyg view for editing. The best (only?) html renderer I could find for python was webkit (I am using the PyQt version).
Question:
How do I accomplish wysiwyg editing? The requirements/issues are as follows:
An ebook may be up to 10,000 paragraphs / 1,000,000
characters.
PyQt Webkit (ContentEditable): No problem.
PyQt Webkit (TinyMce, etc): Takes forever to open them!
The format is <body><p>...</p><p>...</p>...</body>. The body element contains only paragraphs, there are no divs, etc (but in the paragraph there may be spans, links, etc.). Editing must take place with no significant delays as far as the user is concerned.
PyQt Webkit (ContentEditable): If you try deleting text across multiple paragraphs, it takes forever!! My understanding is that this is because it resets the common-parent of the elements being changed - i.e. the entire body element, since two different paragraphs are being deleted/merged. But, there should be no need for this - it should need only delete/merge/change those individual paragraphs!
I am open to implementing my own wysiwyg editing, but for the life of me I can't figure out how to delete/cut/paste/merge/change the html code correctly. I searched online for articles about html wysiwyg design theory, and came up dry.
Thanks!
|
backup msSQL stored proc or UDF code via Python
| 8,414,549 | 1 | 0 | 244 | 1 |
c#,python,sql-server,stored-procedures,smo
|
There is no easy way to access SMO from Python (because there is no generic solution for accessing .NET from Python), so I would write a command-line tool in C# and call it from Python using the subprocess module. Perhaps you could do something with ctypes but I have no idea if that's feasible.
But, perhaps a more important question is why you want or need to do this. Does the structure of your database really change so often? If so, presumably you have no real control over it so what benefit does source control have in that scenario? How do you deploy database changes in the first place? Usually changes go from source control into production, not the other way around, so the 'master' source of DDL (including tables, indexes etc.) is SVN, not the database. But you haven't given much information about what you really need to achieve, so perhaps there is a good reason for needing to do this in your environment.
| 0 | 0 | 0 | 0 |
2011-12-07T09:00:00.000
| 1 | 0.197375 | false | 8,412,636 | 0 | 0 | 1 | 1 |
The idea is to make a script that would get stored procedure and udf contents (code) every hour (for example) and add it to SVN repo. As a result we have sql versioning control system.
Does anyone know how to backup stored procedure code using Python (sqlAlchemy, pyodbc or smth).
I'v done this via C# before using SQL Management Objects.
Thanks in advance!
|
Filter POST data in Django
| 8,418,076 | 1 | 0 | 688 | 0 |
python,django,django-models
|
django takes care of safely storing strings in the database. html is a worry when displaying to the user, and django provides some help there as well, escaping html unless explicitly told not to
| 0 | 0 | 0 | 0 |
2011-12-07T15:36:00.000
| 2 | 1.2 | true | 8,417,971 | 0 | 0 | 1 | 1 |
I have a view in django that is going to save HTML data to a model, and I'm wondering how I might go about filtering it before saving it to the model? Are there built in functions for it? I know there are template filters, but I don't think those help me in this case.
What I'll be doing is getting the content of a div via JQuery, sending that to a view via ajax, then saving it to a model.
|
Dynamically reload the URLConfs for a running site
| 8,421,524 | 5 | 3 | 203 | 0 |
python,django
|
Your question starts from a premise that most Django programmers wouldn't accept: that you can or should create URLs dynamically from the database. If you're doing that, you're doing it wrong.
Your URL patterns are part of the code, not the data. Obviously, the URLs themselves are formed by combining the patterns with the data - eg foo/<slug>/bar/, but this doesn't need reloading when new slugs are added because it is resolved by the view, not the URL processor.
| 0 | 0 | 0 | 0 |
2011-12-07T17:23:00.000
| 2 | 1.2 | true | 8,419,669 | 0 | 0 | 1 | 1 |
I have a django site. Like all standard sites, it uses URLConfs to associate URLs with views. However, in addition to that, I have some URL configs which I dynamically generate from data in the database. Everything works as I would like it.
Is it possible to reload all the URLConfs while the site is running, from code? In case someone updates the database and change some of the URLs in the site, I would like to trigger a "rediscovery" of all the URLs. This would cause my code to dynamically re-create the URLs from the data in the DB.
Currently, the generated URLs can be anywhere in the URL hierarchy. They are not all under one prefix, such as /dynamic/ or such. However, if this is absolutely necessary to do what I need to get done, I can place all the dynamic URLs under one prefix.
Some downtime is allowed for the site while the rediscovery of URLs take place.
How would I trigger such a reloading of all the URLConfs?
|
Python Pip vs Ruby Gems
| 8,507,138 | 0 | 5 | 3,102 | 0 |
python,ruby,rubygems,pip
|
I think you should raise your problem about gem/debian and what are you going to do with it specially.
I am using pip and debian now and still no problem by now.
| 0 | 1 | 0 | 1 |
2011-12-08T16:04:00.000
| 1 | 0 | false | 8,433,881 | 0 | 0 | 1 | 1 |
I mostly do work in Python, but I have been using some of the Ruby stuff for Server Configuration Management (ie Puppet and Chef). I also use Ubuntu/Debian as my primary Linux distro for servers.
Why is there a weird Debian/Ruby conflict over Gems, and not a similar showdown between Debian/Python over Pip?
Personally, I don't mind installing newer packages then the "system" approves of. I know Debian wants to make a stable system, but when I am running my own application code on the server, I can guarantee you it's not stable to begin with.
Anyway, I would be interested to know if Pip is doing something different, or if it's an ego thing or whatever?
|
Is there anything wrong with this password reset procedure?
| 8,461,239 | 4 | 2 | 647 | 0 |
python,security,flask
|
If I can enter a username and email address, then I can get a reset token for any user of your service emailed to me. Maybe you should check that the email address is one that actually belongs to the user whose password is going to be reset.
| 0 | 0 | 0 | 0 |
2011-12-10T13:38:00.000
| 4 | 0.197375 | false | 8,456,886 | 0 | 0 | 1 | 3 |
Is there anything wrong with this procedure?
Enter in username and email in a reset form.
Flask creates a really long random string and stores it into the session under "reset_code". Session will also have a key for "reset_pw_username"
Flask sends an email with a link to the path /password_reset/reset_pw_username/reset_code
That link displays a form where the customer can reset the password if the session reset code matches the session reset_code item. Otherwise it bombs out.
The session will expire the reset code after an hour.
|
Is there anything wrong with this password reset procedure?
| 8,463,756 | 1 | 2 | 647 | 0 |
python,security,flask
|
As Jean-Paul pointed out, asking for both username and e-mail requires checking whether they both match the same user. Hence it is more common to ask for either username or e-mail, verifying they are in your database, and sending recovery link to appropriate address.
Storing the recovery token in session data will likely be cumbersome for some users, as phihag described. Such tokens are usually stored in regular database. Note, however, that they are password-equivalent: once obtained, they can be freely exchanged for a password. Because of that, they need to salted & hashed (in the same secure manner that is applied to passwords themselves) before storing in the database. This also means that your recovery handler must salt & hash the incoming token before searching for it in your database.
| 0 | 0 | 0 | 0 |
2011-12-10T13:38:00.000
| 4 | 0.049958 | false | 8,456,886 | 0 | 0 | 1 | 3 |
Is there anything wrong with this procedure?
Enter in username and email in a reset form.
Flask creates a really long random string and stores it into the session under "reset_code". Session will also have a key for "reset_pw_username"
Flask sends an email with a link to the path /password_reset/reset_pw_username/reset_code
That link displays a form where the customer can reset the password if the session reset code matches the session reset_code item. Otherwise it bombs out.
The session will expire the reset code after an hour.
|
Is there anything wrong with this password reset procedure?
| 10,258,232 | 0 | 2 | 647 | 0 |
python,security,flask
|
The best solution is use email address as username,then user just have to remember his email address.And you just only have to validate user's email address.
| 0 | 0 | 0 | 0 |
2011-12-10T13:38:00.000
| 4 | 0 | false | 8,456,886 | 0 | 0 | 1 | 3 |
Is there anything wrong with this procedure?
Enter in username and email in a reset form.
Flask creates a really long random string and stores it into the session under "reset_code". Session will also have a key for "reset_pw_username"
Flask sends an email with a link to the path /password_reset/reset_pw_username/reset_code
That link displays a form where the customer can reset the password if the session reset code matches the session reset_code item. Otherwise it bombs out.
The session will expire the reset code after an hour.
|
Invoke javascript methods on a page
| 8,461,984 | 0 | 1 | 119 | 0 |
c#,javascript,python,scripting,browser
|
If you look at the HTTP request header you can determine the user-agent making the request. Based upon that information you can write logic from the server side as to respond with a unique page per detected user-agent string. Then you add any unique JavaScript you want as a static string to be executed by the user-agent application.
| 0 | 0 | 0 | 0 |
2011-12-11T03:28:00.000
| 2 | 0 | false | 8,461,764 | 0 | 0 | 1 | 1 |
Is there a way using either C# or a scripting language, such as Python, to load up a website in the user's default webbrowser and continue to interact it via code (e.g. invoke existing Javascript methods)? When using WinForms, you can host a Webbrowser control and invoke scripts from there, but only IE is supported. Is there a way of doing the same thing in the user's default browser (not necessarily using WinForms)?
Update: The website is stored on the user's machine, not served from a third party server. It is a help page which works dynamically with my C# program. When the user interacts with my C# program, I want to be able to execute the Javascript methods on the website.
|
Best Python Web Framework for my API Server Needs
| 8,466,481 | 0 | 3 | 1,477 | 0 |
python,mysql,api,frameworks
|
Depends on what stage you are at, I would suggest to develop 2 systems because the load to pull data from 3rd party and the load to handle the API would be different. You can scale them into a different types of nodes if you want.
Django-Tastypie (https://github.com/toastdriven/django-tastypie) is not bad, it supports all JSON, XML and YAML. Also you can add OAuth easily. Though, Django itself maybe a bit heavy for your needs at this time.
| 0 | 0 | 0 | 0 |
2011-12-11T18:38:00.000
| 3 | 0 | false | 8,466,425 | 0 | 0 | 1 | 2 |
I am working on developing two systems:
A system that will constantly retrieve economic data from a 3rd party data feed and push it into a MySQL DB (using sqlalchemy)
A server that will allow anyone to query the data in the db over a JSON AJAX API (similar to Yelp or Yahoo API for example)
I have two main questions:
Which Python framework should I use in 2)? Pyramid is my first choice, but if you strongly suggest against it or in favor of something else like Django or Pylons I am definitely wiling to consider it.
Should I develop the two system separately? Or should 1) be a part of 2), running within the framework (using crontab or celery for example)?
|
Best Python Web Framework for my API Server Needs
| 13,210,600 | 0 | 3 | 1,477 | 0 |
python,mysql,api,frameworks
|
I agree with Anthony, you should look at Web2Py. It is very easy to get started, very low learning cure and easy to deploy on many systems including Linux, Windows and Amazon.
So far I have found nothing that Web2Py can not do. But more importantly it does things how you would think they should be done, so if you are not sure, very often a guess is good enough and it just works. If you do get stuck, it has by far the best and most up to date documentation for any Python Web Framework.
Even with all it's great features, easy use and up to date documentation, you will also find that the web2py user group on Google, is like having a paid for help desk staffed 24 hours a day. Most questions are answered with a couple minutes and Massimo (The original creator of Web2Py) goes out of his way not only to help, but to implement new ideas, suggestions and bug fixes within days of them being raised in the group.
| 0 | 0 | 0 | 0 |
2011-12-11T18:38:00.000
| 3 | 0 | false | 8,466,425 | 0 | 0 | 1 | 2 |
I am working on developing two systems:
A system that will constantly retrieve economic data from a 3rd party data feed and push it into a MySQL DB (using sqlalchemy)
A server that will allow anyone to query the data in the db over a JSON AJAX API (similar to Yelp or Yahoo API for example)
I have two main questions:
Which Python framework should I use in 2)? Pyramid is my first choice, but if you strongly suggest against it or in favor of something else like Django or Pylons I am definitely wiling to consider it.
Should I develop the two system separately? Or should 1) be a part of 2), running within the framework (using crontab or celery for example)?
|
Making first name, last name a required attribute rather than an optional one in Django's auth User model
| 8,473,116 | 2 | 11 | 5,078 | 0 |
python,django,forms,validation,authentication
|
I would definitely go with validating on the form. You could even go as far as having more form validation in the admin if you felt like it.
| 0 | 0 | 0 | 0 |
2011-12-11T19:37:00.000
| 4 | 1.2 | true | 8,466,851 | 0 | 0 | 1 | 1 |
I'm trying to make sure that the first name and last name field are not optional for the auth User model but I'm not sure how to change it. I can't use a sub class as I have to use the authentication system.
Two solutions I can think of are:
to put the name in the user profile but it's a little silly to have a field that I can't use correctly.
To validate in the form rather than in the model. I don't think this really fits with Django's philosophy...
For some reason I can't seem to find a way to do this online so any help is appreciated. I would have thought that this would be a popular question.
Cheers,
Durand
|
How do I merge results from target page to current page in scrapy?
| 8,468,824 | 15 | 21 | 10,013 | 0 |
python,web-scraping,scrapy
|
Partially fill your item on the first page, and the put it in your request's meta. When the callback for the next page is called, it can take the partially filled request, put more data into it, and then return it.
| 0 | 0 | 0 | 0 |
2011-12-11T21:38:00.000
| 4 | 1.2 | true | 8,467,700 | 0 | 0 | 1 | 1 |
Need example in scrapy on how to get a link from one page, then follow this link, get more info from the linked page, and merge back with some data from first page.
|
How to know if browser has AJAX (Django)
| 8,468,548 | 1 | 0 | 476 | 0 |
python,ajax,django
|
User agent sniffing and the like is not seen as the best solution... if you can afford that, rather use projects like hasjs on client side to check what the user's browser really is capable and send the information to the server somehow (like, serving the checking page when there is no session, let it do the checks and post the results to the server, which then creates a session and remember the capabilities for that session or the something similar).
| 0 | 0 | 0 | 0 |
2011-12-11T23:38:00.000
| 4 | 0.049958 | false | 8,468,427 | 0 | 0 | 1 | 2 |
In my Django application I would like to know if the browser the client is using has AJAX or not. This is because I have, for example, profile editing. I have a version that edits the user's profile in-place and another one that redirects you to an edit page.
I know that most browsers have AJAX nowadays, but just to make sure, how can I check that in a Django application?
|
How to know if browser has AJAX (Django)
| 8,552,739 | 0 | 0 | 476 | 0 |
python,ajax,django
|
I haven't foun a way to do this, therefore what I could do was prepare a JavaScript-free version and a JavaScript version of my template.
I load a .js file, and it replaces all the links to other pages with AJAX links. Therefore, if the user doesn't have JavaScript he will see all the original links and functionality, and if he has JavaScript he will see all AJAX functionality.
| 0 | 0 | 0 | 0 |
2011-12-11T23:38:00.000
| 4 | 0 | false | 8,468,427 | 0 | 0 | 1 | 2 |
In my Django application I would like to know if the browser the client is using has AJAX or not. This is because I have, for example, profile editing. I have a version that edits the user's profile in-place and another one that redirects you to an edit page.
I know that most browsers have AJAX nowadays, but just to make sure, how can I check that in a Django application?
|
Generic CRUD admin for Flask, with WTForms?
| 8,481,615 | 2 | 5 | 6,567 | 0 |
python,admin,web-frameworks,flask,wtforms
|
The short answer is no, as far as I know, there is no auto-generating ORM for redis or MongoDB.
Now for a more detailed explanation:
The reason why there exists CRUD generation for 'fixed' ORM's and not datastores based in free-form records is simple: the very nature of free-form records makes it difficult to create a schema.
Let's look at redis for example, say each record was a hash e.g. key 'user-{id}' with fields username, age, and registered_on. Now, what happens when you add a new field 'location' to the users? Well, redis doesn't care, you just add the field to any records as they're modified, no need to go back and add the field to every hash. Simple enough.
But now, you have your CRUD magic, which tries to figure out what fields to show. Say you decide looking at the first record to see what fields exist works, but what if user-1 is missing that new 'location' field? Now the CRUD won't generate it.
Furthermore, because redis stores every value as a string, a CRUD wouldn't know that 'age' for example only accepts an integer and registered_on is actually an ISO-formatted date string.
Oh, but you say, MongoDB has datatypes! surely, assuming we ignore the different fields per record allowance, pretending we have the same set of fields per record, it's possible to do some automagic CRUD there? Well yes, you will be able to do a bit better than with Redis, because there's e.g. a date type and integer type, but there are some discrepancies even then. Say you have a string value. How do you know if that string value requires a multi-line input (textarea) or single-line(input type=text), or is even only available from a drop-down select of a few choices?
Because of this, the only way to really do a theoretical CRUD for many free-form types would be if you defined in advance the 'schema' (via a Form definition maybe?) for each record, and maybe implemented some sort of interface class/contract that allowed a CRUD tool to list records to retrieve objects, to retrieve a single record by key, to update/create a record, and to delete a single record by key.
Such a theoretical 'pluggable' CRUD tool would be really cool, and I'd love to see someone take it on.
| 0 | 0 | 0 | 0 |
2011-12-12T03:18:00.000
| 3 | 1.2 | true | 8,469,596 | 0 | 0 | 1 | 1 |
are there any generic CRUD admin for Flask based on WTForms?
Currently we are building a hybrid backend system where admin must CRUD lots of data from various source, MongoDB, Redis, ini file, ENVIRON, etc. Writing specific admin view for each of them seems a waste of time, but all Flask admin or WTForms admin solutions are based on some kind of fixed ORM, e.g. MongoEngine, AppEngine Datastore, SQLAchemy, etc.
Are there any more generic ones which allows ORM-agnostic admin to be automatically generated?
I need it to provide the following functions
list view for a group of items, support inline editing or batch actions would be great!
edit view for one specific item for add/edit
Just define some Form model, implement a iteration method and auto generate a full fledged admin.
Are there any reusable OSS projects like this?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.