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
Print html tags in Django
19,448,846
1
0
2,731
0
python,django,django-templates
That happens by default, because of Django's autoescaping. You have to specifically mark content as safe before it will be interpreted as HTML.
0
0
0
0
2013-10-18T10:29:00.000
4
0.049958
false
19,447,427
0
0
1
3
Is it possible in django to print a string keeping the html tags? So if I write {{ variable }} the html content inside the variable doesn't get interpreted by the browser as html. (Really a newbie) Thanks
Print html tags in Django
19,447,655
2
0
2,731
0
python,django,django-templates
You can use the escape filter {{variable|escape}} Same as php's htmlentities or htmlspecialchars
0
0
0
0
2013-10-18T10:29:00.000
4
0.099668
false
19,447,427
0
0
1
3
Is it possible in django to print a string keeping the html tags? So if I write {{ variable }} the html content inside the variable doesn't get interpreted by the browser as html. (Really a newbie) Thanks
Print html tags in Django
61,307,178
0
0
2,731
0
python,django,django-templates
You can use the safe filter {{variable|safe}}
0
0
0
0
2013-10-18T10:29:00.000
4
0
false
19,447,427
0
0
1
3
Is it possible in django to print a string keeping the html tags? So if I write {{ variable }} the html content inside the variable doesn't get interpreted by the browser as html. (Really a newbie) Thanks
Hierarchy in Google App Engine NDB
19,454,685
5
3
1,057
0
python,google-app-engine
If you use the ancestor in the key you will create a big entity group (assuming a single root to the tree/hierarchy) which may in fact not be what you want from a write performance point of view. Also a deep hierarchy can mean very big keys. If you want to move nodes around using ancestor keys, you have to delete and recreate the entire child hierarchy of keys, where as storing the parent in the node (or the children keys in the parent) means you just store different keys in properties. If you normally walk down the hierarchy (say url traversal) you may find it more efficient to just store the childrens keys in a list in the parent, assuming each level is not going to have too many immediate children, as well as storing the parent key in the child. I would examine your actual requirements in detail before deciding which way to go.
0
1
0
0
2013-10-18T14:28:00.000
2
1.2
true
19,452,172
0
0
1
1
I'm trying to store a hierarchy in NDB and I'm confused about if I should use just the 'parent' parameter while constructing the keys to new entities or should I include an extra property in my models to hold the parent key?
Django, project structure
19,463,759
1
4
2,336
0
python,django,structure
If the module is independent from Django, then it should be a standalone Python package, complete with a setup.py to install it. The Django models and webservices that use it can import like any other external dependencies. If the module depends on you Django app, then it should be inside the app's directory. If it doesn't define new models, then it should not be in models.py. Does this answer your question?
0
0
0
0
2013-10-19T07:42:00.000
2
1.2
true
19,463,702
0
0
1
1
I'm currently working on a django project. I'm not completly new in django, but have some difficulties figuring out how would be the most 'djangonic' way to organize some files. I have some classe that compute stuff, and can be used from the manage.py's cli, and by a webservice app. Those computation uses models from my core app and make call to the database. The problem I face is that I can't figure where to put those source file. I do not want to put them in a 'lib' folder. I think the modules in this folder will be django independent modules. For the moment, the module is in the model of my app. But since it doesn't define any new structure, I don't think it is the cleanest way. Any ideo to have a clean structure that respect the 'django way of life' ? Thanks
Issue creating project with mezzanine - shared hosting
21,524,630
0
0
265
0
python,shared-hosting,mezzanine
Now supporting with Mezzanine 3.x
0
1
0
0
2013-10-19T10:44:00.000
2
0
false
19,465,158
0
0
1
1
I'm trying to use Mezzanine cms in a shared hosting at 1and1. I installed a recent python version 3.3.2. setup works well but when i try to create a project I got the following error message: ~/Mezzanine-1.4.16 > mezzanine-project blog Traceback (most recent call last): File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/bin/mezzanine-project", line 9, in load_entry_point('Mezzanine==1.4.16', 'console_scripts', 'mezzanine-project')() File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 345, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2382, in load_entry_point return ep.load() File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/distribute-0.6.49-py3.3.egg/pkg_resources.py", line 2088, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/Mezzanine-1.4.16-py3.3.egg/mezzanine/bin/mezzanine_project.py", line 9, in from mezzanine.utils.importing import path_for_import File "/kunden/homepages/x/dxxxxxxx/htdocs/custom/lib/python3.3/site-packages/Mezzanine-1.4.16-py3.3.egg/mezzanine/utils/importing.py", line 23 except (ValueError, ImportError, AttributeError), e: ^ SyntaxError: invalid syntax Any thoughts on how to fix this ? thank you.
RedirectRoute in Google App Engine and url arguments
19,500,983
1
1
156
0
python,google-app-engine,webapp2
A RedirectRoute will issue a HTTP redirect telling the browser to go to the new URL, then the browser will make a new request at that URL. How this is implemented is that two routes are created - your original route, and one for redirecting. So, in your case, a route with /do/some/<action:.*>/ would be created that redirects to /do/some/<action.*>. However, I think your route actually will be checked first (not positive, sorry), so it would just always fire. I would modify it to not match slashes, if that's okay. Luckily, that's the default behaviour if you omit the regex, so just /do/some/<action:> should work!
0
1
0
0
2013-10-21T15:48:00.000
1
0.197375
false
19,499,079
0
0
1
1
I have a RESTful API like /do/some/<action:.*> so my app with get <action> and run it. My question is, if I use RedirectRoute and strict_slash=True, will my app keep getting <action> as argument or will it start getting <action>/ (notice the / at the end)? EDIT: I'm using webapp2
Django FileField appending temporary path name to media_root path on save
19,501,434
0
0
343
0
python,django
The problem lies in the to_upload method, I was getting filename and using it as it came. The fix was to do: filename = os.path.basename(filename) and use that
0
0
0
0
2013-10-21T17:23:00.000
1
0
false
19,500,897
0
0
1
1
I have this custom ModelAdmin that unzips the uploaded file to /tmp and the sets the unzipped file to a FileField in a model doing mymodel.myfilefield = File(open(path_to_file)) The thing is that after doing that the new file is copied to <MEDIA_ROOT>/<upload_to>/tmp/<filename> And that's not desired. Why is appending the 'tmp' path? Thanks
How to avoid hitting App Engines free limits with tons of writes?
19,508,340
0
0
49
0
python,google-app-engine
Pack more data into an entity, and arrange to not index any fields you're never going to query on. That may interfere with querying your logs, but if writes predominate, pack more into each write, saving writes and index updates. You'll pay for it later when querying, but if queries are infrequent, it may be a net win.
0
1
0
0
2013-10-22T02:12:00.000
1
1.2
true
19,507,887
0
0
1
1
I'm trying to handle remote logging with app engine, but I find just by myself I'm exceeding the daily write limit. Are there any datastore tricks I can use to consume less of my write quota while posting data to the server constantly?
Parse HTML Infinite Scroll
19,512,436
1
1
1,165
0
python,infinite-scroll
Those pages update their html with AJAX. Usually you just need to find the new AJAX requests send by browser, guess the meaning of the AJAX url parameters and fetch the data from the API. API servers may validate the user agent, referer, cookie, oauth_token ... of the AJAX request, keep an eye on them.
0
0
1
0
2013-10-22T08:01:00.000
2
1.2
true
19,512,250
0
0
1
1
I'm trying to parse the HTML of a page with infinite scrolling. I want to load all of the content so that I can parse it all. I'm using Python. Any hints?
Does print statement will make performance issue for a website
19,527,376
2
0
1,976
0
python,django,web
Yes, since the arguments will need to be converted to strings before outputting and that can be a costly operation. However, using print causes another issue. Some WSGI containers, notably mod_wsgi among them, do not like anything sent to stdout by default and so will raise an exception whenever that happens. You can fix this by printing to stderr instead, but the performance issue will remain.
0
0
0
0
2013-10-22T19:54:00.000
2
1.2
true
19,527,097
1
0
1
1
We are using the python/Django for web development. While development phase wile coding i tends to put print statement a lot places to check the control flow of the code. And same code with print statement is uploaded for server, I know logging is a place to be more suitable but i find myself more comfortable with print. I want to know how few lines of code will make site slow, if it makes it slow. Lets say i have 100 line of code and upon that i added 5 print statements. another way of looking into it is to i wrote a 105 line of code. Then in that sense i should not make difference (i suppose). Does this will make the website slow ?
Passing flash messages in flask framework
19,535,937
2
0
4,516
0
python,flask
Redirect with parameter: you set parameter for page1 link/form on page2 and if parameter set for page1 then show message. Good solution. Redirect with special route: you have special route for page1 redirection from page2. It's similar to parameter. Redirect with referer: you check http referer header to page2 for page1. Good solution, but can have issues with proxies. Redirect with anchor: you set anchor on page2 and redirect without anchor replacing to page1, on page1 you check anchor and show message. This is best way for me when you have active ajax requests and store session in cookies. Good solution. Store history in storage on frontend: you save page visiting or message for page1 on session storage and if page1 visited after page2 or message flag set and visited page1 then show message. Store history in storage on backend: you save pages visiting and if page1 visited after page2 then show message.
0
0
0
0
2013-10-23T05:47:00.000
2
1.2
true
19,533,736
0
0
1
1
I have a use case where, when page2 redirects user to page1, page 1 is supposed to show a flash message (e..g Your order was successfully placed). When a user visits page1 directly without being redirected from page2, I don't show any flash messages. What is the best way to send flash_message from page2 to page1 while redirect. Currently I am sending it as a query parameter. Page1 by default has a optional parameter, flash_message, but when user provides flash_message, it shows that flash message. Is this how flash messages are passed between pages in flask
Using Scrapy with OS X 10.9
20,172,902
2
2
1,390
0
python,macos,scrapy
Some questions from osx 10.9. try xcode-select --install
0
0
1
0
2013-10-23T15:22:00.000
1
0.379949
false
19,545,847
0
0
1
1
I recently updated from OS X 10.8 to OS X 10.9. It looks like the upgrade removed the previous version of Python and all the libraries that were installed. I am trying to re-install Scrapy on OS X 10.9 but I keep getting an error using both pip and easy_install. Here is the error message I am encountering. /private/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found #include "libxml/xmlversion.h" ^ 1 error generated. error: command 'cc' failed with exit status 1 Does anyone know to resolve this or have a work around?
Is Django's "Model" API thread-safe?
19,551,006
3
1
1,406
0
python,django,multithreading,thread-safety
As far as we speak about save versus get and query, you are safe, since distinct querysets objects are involved. In fact, every query, filter, get call and so on creates a new queryset instance, and do not modify any previously existed object. But obviously, you can run into issues when accessing/modifying same db record simultaneously from several threads/clients so on. As I remember, to deal with database updates consistency, in oracle db and mysql inndodb with disabled autocommit there is a select for update statement.
0
0
0
0
2013-10-23T18:31:00.000
1
1.2
true
19,549,655
0
0
1
1
Specifically, I'm only talking about modifying separate instances of a Model (not sharing the same exact instance) across threads. But is it safe to be calling save() from one thread, while multiple other threads are invoking Model.objects.query() or Model.objects.get() for example?
How to serialize and deserialize Django ORM query (not queryset)?
19,561,000
2
2
1,324
0
python,sql,django,serialization
According to your answer, User passes some content-specific parameters into a form, then view function, that recieves POST, constructs query one option is to store parameters (pickle'd or json'ed, or in a model) and reconstruct query with regular django means. This is somewhat more robust solution, since it can handle some datastructure changes.
0
0
0
0
2013-10-24T08:30:00.000
3
0.132549
false
19,560,838
0
0
1
2
My use case is that I need to store queries in DB and retrieve them from time to time and evaluate. Thats needed for mailing-app where every user can subscribe to a web-site content selected by individually customized query. Most basic solution is to store raw SQL and use it with RawQuerySet. But I wonder is there better solutions?
How to serialize and deserialize Django ORM query (not queryset)?
19,561,051
1
2
1,324
0
python,sql,django,serialization
You could create a new model user_option and store the selections in this table. From your question, it's hard to determine whether it is a better solution, but it would make your user's choices more explicit in your data structure.
0
0
0
0
2013-10-24T08:30:00.000
3
0.066568
false
19,560,838
0
0
1
2
My use case is that I need to store queries in DB and retrieve them from time to time and evaluate. Thats needed for mailing-app where every user can subscribe to a web-site content selected by individually customized query. Most basic solution is to store raw SQL and use it with RawQuerySet. But I wonder is there better solutions?
What is the difference between using HttpUwsgiModule for NGINX and using NGINX as a reverseproxy to uWSGI?
19,688,569
2
1
125
0
python,nginx,webserver,reverse-proxy,uwsgi
Simply put, when you use HttpUwsgiModule NGINX speaks the uwsgi protocol and it can leave out useless informations of the http protocol leading to less overhead and thus better performance.
0
1
0
1
2013-10-24T15:42:00.000
1
1.2
true
19,570,490
0
0
1
1
Using HttpUwsgiModule with NGINX to control uWSGI has become quite popular since its release. I was wondering though, what is the advantage of it, compared to using NGINX as a reverse-proxy to uWSGI application? What are the gains and losses in two differing use cases?
Host Parameter While Creating a User in Rackspace Cloud Database Instance
19,761,340
0
1
70
1
python,mysql,database,cloud,rackspace-cloud
I released version 1.6.1 of pyrax a few days ago that adds support for the 'host' parameter for users, as well as for Cloud Database backups.
0
0
0
0
2013-10-25T09:17:00.000
2
1.2
true
19,585,830
0
0
1
1
Rackspace has added the feature to select certain cloud servers (as hosts) while creating a user in a cloud database instance. This allows the specified user to be accessed, only from those cloud servers. So I would like to know whether there is an API available in pyrax(python SDK for Rackspace APIs) to accomplish this or not. If possible, then how to pass multiple cloud server IPs using the API. Thanks,
Generating a date relative to another date in Django template
19,624,727
0
3
3,339
0
python,django,django-templates
This cannot be done in Django templates as of this writing without writing a custom template tag in Python.
0
0
0
0
2013-10-25T19:44:00.000
2
1.2
true
19,598,213
0
0
1
1
I have a date in my template context, and I want to display that date plus 7 days in the rendered output. Something like this (which does not exist): {{some_date|plus_days:7}} How can I do this in a Django template without writing any Python code?
Android Client and Google App Engine APIs
19,613,781
1
0
127
0
java,android,python,google-app-engine
Yes, you can use Python to do what you want. Google designs their services (such as GAE and endpoints) to be language agnostic, e.g. using JSON to serialize objects. There are a few advantages to using Java on both, such as being able to share code between client and service projects, but Google does not promote such dependencies at all - you will have no problem using Python instead.
0
1
0
0
2013-10-26T22:37:00.000
1
1.2
true
19,612,642
0
0
1
1
Am I confused as to what is possible between an Android Client and Google App Engine? I would like to be able to create a Python API that would handle requests between GAE services such as Datastore, and an Android Client. I have found some examples that detail how to make a call from within an Android Client, but it doesn't seem to outline whether or not you can pass data to any specific API language. The question I have is whether or not it is possible to use a Python API deployed on GAE and making calls through Google End Points, or would I have to use Java Servlets to handle requests?
Testing Django application cookies , sessions and states
19,616,880
2
1
1,147
0
python,django,session,testing,cookies
The two statements do not contradict one another. You can use self.client more than once during one test. You can log in, and the cookie handling in the test client will 'remember' your session, for subsequent requests. Only when the test is done, is that state cleared. You do not need to log out, because that's a client state stored with cookies, and that state is cleared when the test is done. Only use .logout() if you wanted to test what happens after a user has logged in but their session has expired, or similar scenarios.
0
0
0
0
2013-10-27T10:02:00.000
1
1.2
true
19,616,817
0
0
1
1
While reading the documentation I've come across two contradicts paragraphes that I couldn't really understand First one says: The test client is stateful. If a response returns a cookie, then that cookie will be stored >in the test client and sent with all subsequent get() and post() requests. Expiration policies for these cookies are not followed. If you want a cookie to expire, >either delete it manually or create a new Client instance (which will effectively delete all >cookies). While the other: Every test case in a django.test.TestCase instance has access to an instance of a Django >test client. This client can be accessed as self.client. This client is recreated for >each test, so you don’t have to worry about state (such as cookies) carrying over from >one test to another. Simply put, if I were to test login, do I have to use django.contrib.auth.logout() after each login() || post('/login/',data) ? or is it that each test case login|post|get has it's own state/cookies/session data ? it's a bit confusing for me.
Crawl and monitor +1000 websites
19,618,864
0
2
3,232
0
python,scrapy
I will be interested to see what other answers come up for this. I have done some web crawling / scrapping with code that I have written myself using urllib to get the html then just searching the html for what I need, but not tried scrapy yet. I guess to see if there are differences you may just need to compare the previous and new html pages, but you would need to either work out what changes to ignore e.g. dates etc, or what specific changes you are looking for, unless there is an easier way to do this using scrapy. On the storage front you could either store the html data just in a file system or look into just writting it to a database as strings. Just a local database like SQLite should work fine for this, but there are many other options. Finally, I would also advise you to check out the terms on the sites you are planning to scrape and also check for guidance in the robots.txt if included within the html as some sites give guidance on how frequently they are happy for web crawlers to use them etc.
0
0
1
0
2013-10-27T13:44:00.000
2
0
false
19,618,735
0
0
1
1
I need help defining an architecture for a tool that will scrape more than 1000 big websites daily for new updates. I'm planning to use Scrapy for this project: Giving that Scrapy needs a project for each website, how can I handle scraping 1000+ websites and storing it's data with Scrapy in just one project? I tried adding a project generator, but is this a good idea? How can I tell if a website was updated with new content so I can scrape it again? Thanks!
Django admin: live update of change list page
19,624,592
0
0
665
0
python,ajax,django,django-admin
For an easy implantation you could set up a button to only refresh the changelist through an ajax call instead of the whole page (though setting it up with a view would be easier than changing the built in admin site without breaking anything). You can also set that function to refresh on a given interval. Another option is to look at implementing Comet technology such as a push server. It would load new entries whenever they are added (like how Facebook does). It's rather complicated, but if you're up to it it might serve your purpose
0
0
0
0
2013-10-27T22:38:00.000
1
1.2
true
19,624,484
0
0
1
1
I use the Django admin "change list" page to monitor the state of objects created and updated by my site's users. I find myself frequently refreshing the page as my users do their work. Is there a good way to make it automatically refresh, so that I can see new changes within a few seconds? Looking for a technique that is easily reusable across my project's many "change list" pages.
Issue with path to python/pythonpath
19,962,347
0
1
137
0
python,apache,unix,path,fastcgi
I had a call to python interpreter via env program in my fast cgi dispatch script. When I explicitly put path to 2.7 to the first line of the script it works as expected.
0
1
0
1
2013-10-28T05:30:00.000
3
1.2
true
19,627,743
0
0
1
2
I have a VPS with system-wide installed python 2.5. I installed python 2.7 to one of the user's home dir (using --prefix). added it to bashrc and bash_profile, exported python variable to env, and now when I type python in console python 2.7 is running. But when I checked python version from my application (Django using with FastCGI) I still see that it is using 2.5. In ps output I see python processes running for this account and apache processes runing with hosting-specific account. How can I switch this particular account to 2.7 without changing system-wide version? Thanks!
Issue with path to python/pythonpath
27,295,744
0
1
137
0
python,apache,unix,path,fastcgi
I've set PYTHONPATH in my /home/me/.bashrc and all worked ok from terminal, but when Apache w/ mod_wsgi starts my python scripts, it acts under sysem or dedicated user, which knows nothing of my .bashrc. For this particular situation, I just used apache config (apache2.conf) to set python path for apache (WSGIPythonPath option).
0
1
0
1
2013-10-28T05:30:00.000
3
0
false
19,627,743
0
0
1
2
I have a VPS with system-wide installed python 2.5. I installed python 2.7 to one of the user's home dir (using --prefix). added it to bashrc and bash_profile, exported python variable to env, and now when I type python in console python 2.7 is running. But when I checked python version from my application (Django using with FastCGI) I still see that it is using 2.5. In ps output I see python processes running for this account and apache processes runing with hosting-specific account. How can I switch this particular account to 2.7 without changing system-wide version? Thanks!
Shopify Recurring Application Charge related issue
19,648,899
1
0
482
0
python,shopify
I created a test recurring charge, it worked fine but I was not able to locate where to accept the charge in my test Shopify shop using admin. When you created your charge, you had to provide a callback so that Shopify could send the charge for you to accept. I would look there for it.
0
0
0
0
2013-10-29T02:03:00.000
1
0.197375
false
19,648,377
0
0
1
1
While testing Shopify recurring application charge today I got stuck in following issues, can anyone please look into this.... I created a test recurring charge, it worked fine but I was not able to locate where to accept the charge in my test Shopify shop using admin. I can see or query the newly created test recurring-application-charge object but can not remove or cancel it. Whenever I tried to remove, it gave me a ResourceInvalid: HTTP Error 422: Unprocessable Entity I am using Shopify python api to interact with Shopify server.
Suspend on exceptions caused inside Django app in PyCharm
19,657,857
0
1
277
0
python,django,debugging,exception,pycharm
This should happen automatically in PyCharm. What you need to do is set no breakpoints, but run as debug (click on the green bug icon). When the exception occurs, execution should automatically halt.
0
0
0
0
2013-10-29T11:46:00.000
1
0
false
19,657,370
1
0
1
1
I debug django application and want to suspend code execution at the point where exception occurs with cursor pointing to problematic place in code. Pretty HTML display by django would be helpful either but not mandatory. My IDE is PyCharm. If I set pycharm to suspend on termination of exception, then I never catch it, because django handles the exception with HTML debug info and exceptions never terminate. Setting DEBUG_PROPAGATE_EXCEPTIONS = True inside settings.py causes HTML debug info to disappear but the execution does not terminate either. If I set pycharm to suspend on raise of exception, then I have to pass all existing exceptions inside py internals such as copy.py, decimal.py, gettext.py, etc, which is inconvenient (there are so many of them that I could never reach exceptions caused by my code). If I set "temporary" setup to suspend on raise of exception which occurs after given breakpoint (which I place at the last line of settings.py) then django server does not start. Thanks in advance for your help.
SELECT using psql returns no rows even though data is there
19,665,116
1
1
82
1
python,django,postgresql
I guess you forgot to enter semicolon: SELECT * FROM myapp_stories;
0
0
0
0
2013-10-29T17:05:00.000
2
0.099668
false
19,664,732
0
0
1
2
I'm using Django + Postgres. When I do a SQL query using psql, e.g. \d+ myapp_stories correctly shows the columns in the table But when I do SELECT * FROM myapp_stories, it returns nothing. But querying the same database & table from my python code returns data just fine. So there is data in the table. Any thoughts? I'm using venv, not sure if that affects anything. Thanks in advance!
SELECT using psql returns no rows even though data is there
19,666,882
1
1
82
1
python,django,postgresql
Prefix the table in your query with the schema, as the search_path might be causing your query (or psql) to look in a schema other than what you are expecting.
0
0
0
0
2013-10-29T17:05:00.000
2
0.099668
false
19,664,732
0
0
1
2
I'm using Django + Postgres. When I do a SQL query using psql, e.g. \d+ myapp_stories correctly shows the columns in the table But when I do SELECT * FROM myapp_stories, it returns nothing. But querying the same database & table from my python code returns data just fine. So there is data in the table. Any thoughts? I'm using venv, not sure if that affects anything. Thanks in advance!
pyramid static view and file upload
19,686,469
0
1
198
0
python,file-upload,pyramid
This sounds like your browser is caching the images. Try setting the cache_max_age=0 on your add_static_view, or viewing the page in your browser's incognito mode where it'll use a different cache.
0
0
0
0
2013-10-29T20:05:00.000
1
1.2
true
19,668,027
0
0
1
1
I created new directory via 'myimages' under static directory. And whenever user upload files, file get stores in that directory. Once file uploaded I can access that on html using '/static/myimages/imagename.png'. It works fine whenever I am uploading new image. But whenver I try to override image. It shows me old image only. I manually check in directory. It has new image, but still when I try to access that via browser, it gives me old image.
Difference between BeautifulSoup and Scrapy crawler?
66,479,925
1
150
84,428
0
python,beautifulsoup,scrapy,web-crawler
Beautifulsoup is web scraping small library. it does your job but sometime it does not satisfy your needs.i mean if you scrape websites in large amount of data so here in this case beautifulsoup fails. In this case you should use Scrapy which is a complete scraping framework which will do you job. Also scrapy has support for databases(all kind of databases) so it is a huge of scrapy over other web scraping libraries.
0
0
1
0
2013-10-30T15:43:00.000
9
0.022219
false
19,687,421
0
0
1
6
I want to make a website that shows the comparison between amazon and e-bay product price. Which of these will work better and why? I am somewhat familiar with BeautifulSoup but not so much with Scrapy crawler.
Difference between BeautifulSoup and Scrapy crawler?
54,838,886
0
150
84,428
0
python,beautifulsoup,scrapy,web-crawler
The differences are many and selection of any tool/technology depends on individual needs. Few major differences are: BeautifulSoup is comparatively is easy to learn than Scrapy. The extensions, support, community is larger for Scrapy than for BeautifulSoup. Scrapy should be considered as a Spider while BeautifulSoup is a Parser.
0
0
1
0
2013-10-30T15:43:00.000
9
0
false
19,687,421
0
0
1
6
I want to make a website that shows the comparison between amazon and e-bay product price. Which of these will work better and why? I am somewhat familiar with BeautifulSoup but not so much with Scrapy crawler.
Difference between BeautifulSoup and Scrapy crawler?
49,187,707
1
150
84,428
0
python,beautifulsoup,scrapy,web-crawler
Using scrapy you can save tons of code and start with structured programming, If you dont like any of the scapy's pre-written methods then BeautifulSoup can be used in the place of scrapy method. Big project takes both advantages.
0
0
1
0
2013-10-30T15:43:00.000
9
0.022219
false
19,687,421
0
0
1
6
I want to make a website that shows the comparison between amazon and e-bay product price. Which of these will work better and why? I am somewhat familiar with BeautifulSoup but not so much with Scrapy crawler.
Difference between BeautifulSoup and Scrapy crawler?
46,601,960
3
150
84,428
0
python,beautifulsoup,scrapy,web-crawler
Both are using to parse data. Scrapy: Scrapy is a fast high-level web crawling and web scraping framework, used to crawl websites and extract structured data from their pages. But it has some limitations when data comes from java script or loading dynamicaly, we can over come it by using packages like splash, selenium etc. BeautifulSoup: Beautiful Soup is a Python library for pulling data out of HTML and XML files. we can use this package for getting data from java script or dynamically loading pages. Scrapy with BeautifulSoup is one of the best combo we can work with for scraping static and dynamic contents
0
0
1
0
2013-10-30T15:43:00.000
9
0.066568
false
19,687,421
0
0
1
6
I want to make a website that shows the comparison between amazon and e-bay product price. Which of these will work better and why? I am somewhat familiar with BeautifulSoup but not so much with Scrapy crawler.
Difference between BeautifulSoup and Scrapy crawler?
19,687,572
21
150
84,428
0
python,beautifulsoup,scrapy,web-crawler
I think both are good... im doing a project right now that use both. First i scrap all the pages using scrapy and save that on a mongodb collection using their pipelines, also downloading the images that exists on the page. After that i use BeautifulSoup4 to make a pos-processing where i must change attributes values and get some special tags. If you don't know which pages products you want, a good tool will be scrapy since you can use their crawlers to run all amazon/ebay website looking for the products without making a explicit for loop. Take a look at the scrapy documentation, it's very simple to use.
0
0
1
0
2013-10-30T15:43:00.000
9
1
false
19,687,421
0
0
1
6
I want to make a website that shows the comparison between amazon and e-bay product price. Which of these will work better and why? I am somewhat familiar with BeautifulSoup but not so much with Scrapy crawler.
Difference between BeautifulSoup and Scrapy crawler?
24,040,613
2
150
84,428
0
python,beautifulsoup,scrapy,web-crawler
The way I do it is to use the eBay/Amazon API's rather than scrapy, and then parse the results using BeautifulSoup. The APIs gives you an official way of getting the same data that you would have got from scrapy crawler, with no need to worry about hiding your identity, mess about with proxies,etc.
0
0
1
0
2013-10-30T15:43:00.000
9
0.044415
false
19,687,421
0
0
1
6
I want to make a website that shows the comparison between amazon and e-bay product price. Which of these will work better and why? I am somewhat familiar with BeautifulSoup but not so much with Scrapy crawler.
Using GPIO in webpage
19,702,189
2
0
467
0
python,django,raspberry-pi
You don't have to run the webbrowser as root but your django app (the webserver). Of course running a web application as root is an incredibly bad idea (even on a pi), so you might want to use a separate worker process (e.g. using celery) that runs as root and accesses the GPIOs.
0
1
0
0
2013-10-31T08:59:00.000
1
1.2
true
19,702,170
0
0
1
1
I am using Django 1.5.4 to design a web page in which i want to use GPIO, but i got following error: "Noᅠaccessᅠtoᅠ/dev/mem. Tryᅠrunningᅠasᅠroot! " in browser. Since web browser itself is an application, how can i assign "root" privileges to it when it tried to render a web page ? If it can be done without any need to install anything that would be better as other frameworks/applications who are able to use GPIO in web page must have made some tweaks.I tried searching for similar questions for this area but couldn't find this specific case ( django + gpio access). Any help would be greatly appreciated. Thanks
how to run python code on amazon ec2 webservice?
19,714,085
0
0
718
0
python,amazon-web-services,amazon-s3,amazon-ec2,cluster-computing
You do not need to use S3, you would likely want to use EBS for storing the code if you need it to be preserved between instance launches. When you launch an instance you have the option to add an ebs storage volume to the drive. That drive will automatically be mounted to the instance and you can access it just like you would on any physical machine. ssh your code up to the amazon machine and fire away.
0
1
0
0
2013-10-31T17:35:00.000
1
0
false
19,713,141
0
0
1
1
I have never used amazon web services so I apologize for the naive question. I am looking to run my code on a cluster as the quad-core architecture on my local machine doesn't seem to be doing the job. The documentation seems overwhelming and I don't even know which AWS services are going to be used for running my script on EC2. Would I have to use their storage facility (S3) because I guess if I have to run my script, I'm going to have to store it on the cloud in a place where the cluster instance has access to the files or do I upload my files somewhere else while working with EC2? If this is true is it possible for me to upload my entire directory which has all the contents of the files required by my application onto s3. Any guidance would be much appreciated. So I guess my question is do I have to use S3 to store my code in a place accessible by the cluster? If so is there an easy way to do it? Meaning I have only seen examples of creating buckets wherein one file can be transferred per bucket. Can you transfer an entire folder into a bucket? If we don't require to use S3 then which other service should I use to give the cluster access to my scripts to be executed? Thanks in advance!
Stress test on Django makes it slow while there are free system resources
19,714,529
1
0
389
0
python,mysql,django,apache
Probably caching is your answer. I don't know how Django runs on Apache as I run a Gunicorn setup but it makes round trips for every database call. If you institute some memcache to handle common result sets you should see a large improvement so you don't have to make trips for each request. Also, 50 concurrent connection requests at a time seems like a lot. Try to tone it down to 5 or 10 then 25 instead of starting at 50. Just my opinion.
0
0
0
0
2013-10-31T18:53:00.000
2
0.099668
false
19,714,463
0
0
1
2
Today I was doing a stress test to a new Django (1.5.4) running on an Ubuntu Server 12.04 site before going into production and I've found some unexpected results: Doing 50 requests per second, htop showed a CPU usage of ~50% and RAM also ~50%. I'm not currently using Django cache and doing a normal browser request while doing the stress test it took ~30s to load each page (without any load it takes <= 2s). The server didn't crash during the test, but I dont understad why if there are almost 50% of the resources free it lasts so much... I expected to see a higher CPU and memory usage! So, my question is: Is there any Django default setting that limits the number of requests per second? Or does Apache or mod_wsgi have any kind of limit? Do I have to change some MySQL config? (Note: I'm a software engineer, not sysadmin).
Stress test on Django makes it slow while there are free system resources
19,719,423
0
0
389
0
python,mysql,django,apache
How many workers of django you are running? Maybe server can't load to 100% because you are running small amount of workers, but there are many database connections, so most of the time workers are waiting database, and blocking new connections.
0
0
0
0
2013-10-31T18:53:00.000
2
1.2
true
19,714,463
0
0
1
2
Today I was doing a stress test to a new Django (1.5.4) running on an Ubuntu Server 12.04 site before going into production and I've found some unexpected results: Doing 50 requests per second, htop showed a CPU usage of ~50% and RAM also ~50%. I'm not currently using Django cache and doing a normal browser request while doing the stress test it took ~30s to load each page (without any load it takes <= 2s). The server didn't crash during the test, but I dont understad why if there are almost 50% of the resources free it lasts so much... I expected to see a higher CPU and memory usage! So, my question is: Is there any Django default setting that limits the number of requests per second? Or does Apache or mod_wsgi have any kind of limit? Do I have to change some MySQL config? (Note: I'm a software engineer, not sysadmin).
Flask logs everyone out when ever I make changes to the code
19,728,271
2
1
130
0
python,nginx,flask,uwsgi
Sessions are signed against the app.secret_key so perhaps you're automatically generating a new secret key each time you launch your app?
0
0
0
0
2013-10-31T23:57:00.000
2
1.2
true
19,718,673
0
0
1
1
I am using Flask and Nginx on my production server and Flask seems to log everyone out whenever I make a change to the code. I realize the reason for this, but I was wondering if there is any way to prevent this. I am using a proxy with Nginx if that makes any difference, I could easily switch back to uwsgi if that will fix the problem but I would prefer to keep my configuration the way it is. Thanks for your help. EDIT: If there is any confusion, I am trying to find a way to keep everyone logged in when I make changes to my code.
Are django signals always synchronous?
19,731,987
8
4
3,964
0
python,django,queue,signals
Not sure synchronicity is your real concern here. Django's signals are always executed in-process: that is, they will be executed by the process that did the rest of that request, before returning a response. However, if your server itself is asynchronous, there's a possibility that one request will finish processing after a second one that was received later, and therefore the signals will be processed in the wrong order. Celery, of course, is definitely asynchronous, but might well be a better bet if reliable ordering is a priority for you.
0
0
0
0
2013-11-01T16:48:00.000
1
1.2
true
19,731,349
0
0
1
1
I'm developing a django IPN plugin that saves IPN data to a model and then calls a post_save signal. I'm worried that under this use case (gunicorn, gevent, etc) that the signals may be called/completed asynchronously. The IPN often sends more than 1 request to the ipn url, and I need to be able to process those requests in order. Should I use a queue for this? Would simple python queue's work better, or should I use something like kombu + celery (with 1 worker)?
How to get the list of users currently logged in to a server for any web service?
21,433,269
0
0
1,048
0
web-services,apache,python-2.7,postgresql-9.2
Note that you cannot get a list of "all users logged into a web application". You can get a list of "all users who have recently authenticated", or possibly "all users with a valid authentication token", but due to the stateless nature of web connections, the concept of "currently logged in" is a tricky one (if I close my browser window, am I "logged out"? What if I open a connection in a new window -- have I logged back in, or was I logged in the whole time?). Having said that, all of the web applications you've named have their own mechanism for handling user authentication. Unless you have configured some sort of single sign-on (SSO) solution, you'll have to query each application individually to get information about currently authenticated users. If you are working with a number of web applications, setting up single sign-on can be incredibly convenient, but depending on the web applications in question can be tricky to configure. Be careful of thinking in terms of "client machines", because that is something else that's a tricky concept. A bunch of people using a residential or hotel internet connection may all appear to come from the same ip address, even though there are a number of clients. Several people may share a single computer, or someone may open multiple browser sessions to the application.
0
0
0
0
2013-11-01T16:52:00.000
1
0
false
19,731,409
0
0
1
1
I am planning to install bugzilla/trac, mediawiki and some other web services on a server via apache. I would like to know if there is a way to track which all users(username of the specific web service from different client machines ie) are logged into the server. I am thinking of creating a database, and doing some logic with that. Before that if there is any simpler method then I would like to go for that. This is my first time with server stuff and apache. Thanks in advance
How can I automate google docs with Google App Engine?
19,746,281
0
0
559
0
python,google-app-engine,google-docs-api
There is currently no API to create google docs directly except for: 1) make a google apps script service, which does have access to the docs api. 2) create a ".doc" then upload and convert to gdoc. 1 is best but a gas service has some limitations like quotas. If you are only creating dozens/hundreds per day you will be ok with quotas. Ive done it this way for something similar as your case.
0
1
0
0
2013-11-02T18:16:00.000
1
1.2
true
19,745,169
0
0
1
1
Listmates: I am designing a google app engine (python) app to automate law office documents. I plan on using GAE, google docs, and google drive to create and store the finished documents. My plan is to have case information (client name, case number, etc.) entered and retrieved using GAE web forms and the google datastore. Then I will allow the user to create a motion or other document by inserting the form data into template. The completed document can be further customized by the user, email, printed, and/or stored in a google drive folder. I found information on how to create a web page that can be printed. However, I am looking for information for how to create an actual google doc and insert the form data into that document or template. Can someone point me to a GAE tutorial of any type that steps me through how to do this?
GAE SDK for Python 2.5
19,748,534
1
2
272
0
google-app-engine,sdk,python-2.5
In the 1.8.6 SDK, there's an old_dev_appserver.py that works with Python 2.5. That'll help you along as you migrate.
0
1
0
0
2013-11-02T22:26:00.000
2
1.2
true
19,747,596
0
0
1
2
I have an existing app that uses the deprecated Python 2.5 and the deprecated master/slave datastore. According to the docs, I must migrate the datastore to HRD before I can upgrade to Python 2.7. Before I can migrate my M/S datastore to HRD, I need to do some work on the app and test it using the dev server. However, I upgraded to the most recent version of the SDK (1.8.6), and it does not support Python 2.5. Somebody else encountered this problem and learned that the latest SDK that supports Python 2.5 by default is Python SDK 1.7.5. From where can that be downloaded? Or, is there a way I can make the SDK 1.8.6 work with Python 2.5?
GAE SDK for Python 2.5
20,110,862
0
2
272
0
google-app-engine,sdk,python-2.5
Dave W. Smith gave me the answer but I didn't know how to implement it until I made a discovery that maybe most people already know, But in case it might be helpful to somebody, I will tell it here: I do all my GAE/Python/Flex development work in Eclispe, except that I used the launcher for local testing and deploying. (I am command-line adverse.) I discovered that using the PyDev Eclipse plugin it is easy to set up a "run configuration" (under the PyDev "Run" menu) whereby you can set up command line parameters, etc. and run any python program from within Eclipse. I now use that facility for running dev_appserver.py (and when needed for my Python 2.5 app, old_app_devserver.py). I no longer have a need to use the launcher. I also set up a PyDev run configuation to deploy my app and performing various appcfg.py functions (vacuum indexes, etc.).
0
1
0
0
2013-11-02T22:26:00.000
2
0
false
19,747,596
0
0
1
2
I have an existing app that uses the deprecated Python 2.5 and the deprecated master/slave datastore. According to the docs, I must migrate the datastore to HRD before I can upgrade to Python 2.7. Before I can migrate my M/S datastore to HRD, I need to do some work on the app and test it using the dev server. However, I upgraded to the most recent version of the SDK (1.8.6), and it does not support Python 2.5. Somebody else encountered this problem and learned that the latest SDK that supports Python 2.5 by default is Python SDK 1.7.5. From where can that be downloaded? Or, is there a way I can make the SDK 1.8.6 work with Python 2.5?
Is a single Python executable file shared by all clients when run on a server?
19,750,550
1
0
269
0
python,django,heroku,tornado
Each client will have their own running version. Definitely. If you want to have some sort of global variables, you should use some inter-process communication tools (message passing, synchronization, shared memory, or rpc). Redis, for example.
0
0
0
0
2013-11-03T06:35:00.000
3
0.066568
false
19,750,453
1
0
1
2
I've been working with a Tornado project on my local machine by running server.py. When deployed to the server (e.g. Heroku), will a single instance of server.py be shared by all clients or will each client have their own running version? I am wondering this because I am thinking of making use of global variables in server.py and wondering if they will be shared across all clients or just a single client.
Is a single Python executable file shared by all clients when run on a server?
19,757,868
0
0
269
0
python,django,heroku,tornado
With Tornado you'll have at least one process per machine/VM (Heroku calls these "dynos"); in multicore environments you'll want to run multiple processes per machine (one per core). Each process handles many users, so in the simple case where there is only one process you can use global variables to share state between users, although as you grow to multiple dynos and processes you'll need some sort of inter-process communication.
0
0
0
0
2013-11-03T06:35:00.000
3
0
false
19,750,453
1
0
1
2
I've been working with a Tornado project on my local machine by running server.py. When deployed to the server (e.g. Heroku), will a single instance of server.py be shared by all clients or will each client have their own running version? I am wondering this because I am thinking of making use of global variables in server.py and wondering if they will be shared across all clients or just a single client.
Easiest way to implement paypal shopping for e-books
21,199,468
0
2
165
0
python,django,paypal,django-paypal
With respect, the question is slightly naive, in that there is typically a separation between the shopping cart, and the payment processing. A payment returns a binary result - it either worked or it didn't. It is up to your application to recall what was being paid for. The Paypal API returns the success or failure of an identified payment; plus will happily consume a list of items you give it, so that the user is presented with a breakdown of the total amount. But note that you are telling paypal what is being paid for. It is consuming that data, not providing it. So the answer depends entirely upon your chosen solution (django-paypal or django-merchant or whatever). Read their documentation. Presumably there is some way to inspect the contents of a recently approved transaction. Cycle through the cart and enable a download of each. Django-paypal, for example, has no interest of what is in the cart. It just fires a signal when a payment is successful, and passes back the transaction identifier. Your application must recall what the transaction was for. Often it's not as easy as you'd hope.
0
0
0
0
2013-11-03T18:57:00.000
1
0
false
19,756,725
0
0
1
1
I have an existing django website, and I would like to sell some pdf files through it using paypal. The buyer needs to be able to select 1 or more books, get transferred to the paypal site to enter in payment info. Then after a successful payment, the buyer gets redirected back to my website and the books start downloading automatically. I have looked at the django-paypal and django-merchent apps, but I don't know how to handle the multiple downloads. As far as I know, using these apps, after a successful purchase, the app sends a success signal, but doesn't tell me which books were ordered. What is the best way to implement this either with the django-paypal app or using some other method? Again, I'm looking for the easiest/quickest solution. Thanks,
Using the GAE remote_api to Create Local Scripts
19,760,171
1
0
71
0
python,google-app-engine,google-cloud-datastore
Why is including the paths that onerous ? Normally the remote_api shell is used interactively but it is a good tool that you can use as the basis of acheiving what your want. The simplest way will be to copy and modify the remote_api shell so that rather than presenting an interactive shell you get it to run a named script. That way it will deal with all the path setup. In the past I have integrated the remote_api inside a zope server, so that plone could publish stuff to appengine. All sort of things are possible with remote_api, however you need to deal with imports like anything else in python, except that appengine libraries are not installed in site-packages.
0
1
0
0
2013-11-04T00:23:00.000
1
1.2
true
19,759,934
0
0
1
1
I'm trying to do some local processing of data entries from the GAE datastore and I am trying to do this by using the remote_api. I just want to write some quick processing scripts that pull some data, but I am getting import errors saying that Python cannot import from google. Am I supposed to run the script from within the development environment somehow. Or perhaps I need to include all of the google stuff in my Python path? That seems excessive though.
Why does django stops loading a page after opening several pages?
19,762,217
0
0
908
0
python,django,windows
It is hard to tell whether the issue is related to Windows specifically, rather than compatibility issues with images/CSS/Javascript/plugins such as Flash. Are you running the latest versions of those browsers (or at least the same versions as on your desktop)? Do you have different security software/firewalls? Do other sites load inconsistently? Seems unlikely to be a Django issue (although you can try loading sites like djangoproject.com).
0
0
0
0
2013-11-04T05:01:00.000
2
0
false
19,761,898
0
0
1
1
I have several django projects and they work well on my desktop. But when I run them on my laptop, they run ok for sometime. Then on a random occasion, opening a page won't work. The browser keeps trying to load the page (title tab keeps spinning, URL changes to the page its trying to open, and the page turns blank), while the development server (django on windows shell) says it has successfully served the page (200 status). This behavior is consistent among Firefox, IE and Chrome. I tried changing ports, using machine IP instead of localhost, loading static files on external server, but nothing works. I tried opening the site (using laptop computer name) from desktop browsers and behaves the same. Another interesting thing is, even if I shutdown and restart the django server, I wont be able to open the page that have failed previously unless I close the loading page. My laptop is running a basic Windows 8, while desktop is Windows 8 Pro. I think the windows version has something to do with it. Does anyone know how to solve this? I hope I made myself clear. Thanks.
Next button is grey
20,859,383
0
0
735
0
eclipse,python-2.7,django-1.5
I had the same problem and managed to fix. Apparently, what caused the problem is that I have included the site-packages directory from a virtual environment into the PYTHONPATH of interpreters. After removing it, the grayed out buttons went normal.
0
0
0
0
2013-11-04T06:19:00.000
1
0
false
19,762,614
0
0
1
1
I have installed eclipse(indego)/python(2.7)/django(1.5.5) properly on a ubuntu 12.04 64bit. but when I start a new pydev project and give a new project name, the 'next' button and 'finish' button are both grey, and no error are shown in create diaglog box. How to create a django project?
How to add a calculated tax in OpenERP 7
19,797,646
0
0
963
0
python,openerp,invoice
A couple of things: You can't just add the tax to the invoice total. Invoice totals are stored functional fields that are calculated as the sum of the invoice lines so you would need to adjust the tax on a specific invoice line, or add a line with the taxes. Taxes are managed via fiscal positions. Create your tax object, then create a fiscal position, then add this as the default for the customer, or just apply it to an invoice on a case by case basis.
0
0
0
0
2013-11-04T08:16:00.000
1
0
false
19,763,836
0
0
1
1
I am working with OpenERP 7. For business requirement, I have to add a tax to the invoice, this tax will be calculated like that : tax1= amount_untaxed * 0,1 % + amount_tax * 0.1 % A little bit of help will be appreciated .
Django can't find libssl on OS X Mavericks
19,772,866
2
2
9,380
1
python,django,macos,postgresql
It seems that it's libssl.1.0.0.dylib that is missing. Mavericks comme with libssl 0.9.8. You need to install libssl via homebrew. If loaderpath points to /usr/lib/, you also need to symlink libssl from /usr/local/Cell/openssl/lib/ into /usr/lib.
0
1
0
0
2013-11-04T12:15:00.000
5
0.07983
false
19,767,569
0
0
1
1
I'm trying to get Django running on OS X Mavericks and I've encountered a bunch of errors along the way, the latest way being that when runpython manage.py runserver to see if everything works, I get this error, which I believe means that it misses libssl: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so Reason: image not found I have already upgraded Python to 2.7.6 with the patch that handles some of the quirks of Mavericks. Any ideas? Full traceback: Unhandled exception in thread started by > Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 93, in inner_run self.validate(display_num_errors=True) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 280, in validate num_errors = get_validation_errors(s, app) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors from django.db import models, connection File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/init.py", line 40, in backend = load_backend(connection.settings_dict['ENGINE']) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/init.py", line 34, in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 93, in getitem backend = load_backend(db['ENGINE']) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/utils.py", line 27, in load_backend return import_module('.base', backend_name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module import(name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 14, in from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/creation.py", line 1, in import psycopg2.extensions File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/init.py", line 50, in from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so Reason: image not found
How to create a django User using DRF's ModelSerializer
19,815,648
0
7
1,321
0
python,django,django-rest-framework
It seems like you should be overriding restore_object() in your serializer, not save(). This will allow you to create your object correctly. However, it looks like you are trying to abuse the framework -- you are trying to make a single create() create two objects (the user and the profile). I am no DRF expert, but I suspect this may cause some problems. You would probably do better by using a custom user model (which would also include the profile in the same object).
0
0
0
0
2013-11-04T13:53:00.000
4
0
false
19,769,186
0
0
1
1
In django, creating a User has a different and unique flow from the usual Model instance creation. You need to call create_user() which is a method of BaseUserManager. Since django REST framework's flow is to do restore_object() and then save_object(), it's not possible to simply create Users using a ModelSerializer in a generic create API endpoint, without hacking you way through. What would be a clean way to solve this? or at least get it working using django's built-in piping? Edit: Important to note that what's specifically not working is that once you try to authenticate the created user instance using django.contrib.auth.authenticate it fails if the instance was simply created using User.objects.create() and not .create_user().
Selenium python: simulate file drag
19,771,618
1
0
1,516
0
jquery,python,selenium,selenium-webdriver
Selenium only works with your web browser. If you are opening something other than a web browser such as file browser you cannot interact with it. Drag and drops work with items within a web browser but not from program such as Windows Explorer or a Linux file explorer to a web browser. Create and element in your browser with jQuery and drag and drop it.
0
0
1
0
2013-11-04T15:35:00.000
4
0.049958
false
19,771,234
0
0
1
1
how can I simulate the action of dragging and dropping a file from the filesystem to an element that has a ondrag event trigger? As for the normale "file" input, I was able to set the value of the input with jQuery. Can't I create a javascript File object or use any similar hack? Thanks Thanks
What type of server Django runserver uses?
19,776,830
12
4
2,017
0
python,django,webserver
It's exactly what it says on the tin - a simple, lightweight web server implemented in Python that ships with Django and is intended for development purposes only. It's not a free-standing web server in its own right and is intended purely for developing applications with Django - you should never use it in production because it simply doesn't offer all the functionality you need in a production web server. A web server can be implemented in virtually any programming language, and so it makes sense to ship one implemented in Python with Django in order that you can get working with it immediately without having to install something like Apache as well. Most web servers that might be used in production, such as Apache and Nginx, are written in C so it wouldn't really be practical to ship them with Django. Also, shipping your own development server cuts down on complexity. Apache and Nginx are both complex pieces of software that require a fair amount of configuration, and while there are ways to automate that during development, it's not something you really want to have to deal with when you'd rather be writing code. All you need to get you started is something that will serve static and dynamic content - you don't need a lot of the other functionality required. It's notable that even PHP now ships with a development server. When you go live with a Django project, you should use of course use a proper web server. It's generally recommended that with Django, in production you should use two web servers, one to serve static content, the other to serve dynamic content, because involving Django in serving static content will slow it down. This sounds odd at first, but it actually makes a lot of sense, because what you do is set one web server to serve all the static content, then have it reverse proxy to the other server, which is running on a non-standard port, and serves all the dynamic content. The setup I have for my current project is Nginx for the static content, with Gunicorn for the dynamic content.
0
0
0
0
2013-11-04T20:19:00.000
1
1.2
true
19,776,363
0
0
1
1
What type of server Django uses when "runserver" command is ran? Documentation says more or less that it's "lightweight development Web server". Is it for example Apache? Thanks in advance.
Create a responsive web app with Django or jQueryMobile?
19,904,103
0
1
7,995
0
python,django,responsive-design
My solution now is as follows: I will use the bottle microframework for generating serverside dynamic html-pages on request. This will cause me to reload the page everytime I want to see new machine information, but for now it is enough for me. Later I can add AJAX for live monitoring (I know this is javascript, I think I have to learn it anyway.) Thanks for your solutions though.
0
0
0
0
2013-11-05T13:12:00.000
3
1.2
true
19,789,816
0
0
1
1
I have a bigger project to handle, so this is what I want to do: I have a Server with an MySQL database and Apache webserver running on. I save some machine information data in the database and want to create a web app to see, e. g. if the machine is running. The web app should be designed responsive, i. e. changing design in accordance to the screen resolution of the current used device. This is important because the app will be used from smartphones and tablets mainly, but should also work on a normal pc. I wrote a Python programm for my machine to get the data, and another Python programm on my server receiving information and saving in the database. So my job now is to create the "responsive website" for my smartphone etc. Then I want to broadcast this with my webserver. Another Point is, that the web app should be build dynamically. If I add another machine to my database, it should appear on my web app to be clickable and then show the related information. First I thought about doing this in HTML5 and CSS3, with the use of jQueryMobile. But I never used javascript. I'm just experienced in the "old" HTML and CSS. Is Django a better choice, since I'm quite experienced in Python? Or do I need both perhaps? I haven't worked with any webframework yet, please help me choosing. Or do I need one at all?
Preferences and settings in a Django Project
19,790,956
1
0
196
0
python,django,settings,preferences
IMHO if the settings depends on user preferences I think a database is the way to store them, not files. Settings files are inherent to project's settings and database storage (normally) is the one who should persist dynamic user preferences.
0
0
0
0
2013-11-05T14:02:00.000
2
0.099668
false
19,790,818
0
0
1
2
I want to add to my django project the ability a user to set his own settings, and Django should remember that when the user logins. I also want my project to have some global settings that will be the same for every user. E.g before a user logs in the system the will be a language set for every user.(global setting) but after the user is authenticated django will switch to his prefered language. What is the best approach for that? My thought was settings file for the global settings (language, locale etc) and a settings application for user-specific preferances. The user-specific preferances might have to do with very simple but specific staff like colors of appearence of things etc. Is creating a settings app the right approach? No code just need a point to right direction first before implementing
Preferences and settings in a Django Project
19,790,987
1
0
196
0
python,django,settings,preferences
Edit: I thought first you want to generate the Django settings based on the admins, I didn't read your question completely. Anyway for user specific settings and preferences, definitely use a database. None use files for such tasks, you can query a database and create all your fields easily using Django's ORM.
0
0
0
0
2013-11-05T14:02:00.000
2
0.099668
false
19,790,818
0
0
1
2
I want to add to my django project the ability a user to set his own settings, and Django should remember that when the user logins. I also want my project to have some global settings that will be the same for every user. E.g before a user logs in the system the will be a language set for every user.(global setting) but after the user is authenticated django will switch to his prefered language. What is the best approach for that? My thought was settings file for the global settings (language, locale etc) and a settings application for user-specific preferances. The user-specific preferances might have to do with very simple but specific staff like colors of appearence of things etc. Is creating a settings app the right approach? No code just need a point to right direction first before implementing
How to execute PERL scripts in Django using async tasker like Celery?
19,791,772
3
0
555
0
python,django,perl,rabbitmq,celery
The easiest way to execute a Perl script from Celery would probably be a thin wrapper written in Python that runs the script as a subprocess.
0
1
0
0
2013-11-05T14:41:00.000
2
0.291313
false
19,791,570
0
0
1
1
I have a need to execute PERL scripts through a Django web interface. The user will select the parameters of the script and execute it. I am wondering if it is possible to use Celery/RabbitMQ to execute these script as Celery tasks? If so, would I need to modify the PERL script? Would I have to write RabbitMQ code into the PERL scripts? Or would I just execute the Celery task and wait for the script to finish processing? I would like to have the script update the Django user/celery.
Where to instantiate shared thread objects in Django, equiv of pyramid registry?
19,795,569
0
1
152
0
python,django,sqlalchemy,pyramid,wsgi
I place my SQLAlchemy/SQLSoup connections at models.py, because it is related to persistence (and to the "model" layer of Model-View-Whatever). You can even replace the Django ORM with SQLAlchemy if you are not using applications relying on the first like django.contrib.admin or django.contrib.auth.
0
0
0
0
2013-11-05T17:21:00.000
1
0
false
19,794,979
0
0
1
1
I'm plugging some framework agnostic code of mine into Django instead of Pyramid. It uses SQLAlchemy and has a customized session factory object for getting db sessions. In pyramid, I instantiate this at server start up in the main app method and attach it to the registry so that all other parts of my app can get at it. I'd like to know what the "correct" way of instantiating and making available a shared factory is in Django. Is there somewhere canonical for putting something like that so that Django users will find it easily and the code will be readable to people used to Django patterns? thanks
Modules not Working across different python versions
19,801,757
0
0
50
1
python,python-2.7,beautifulsoup,mysql-python
If you have 2 versions of python installed on your system, then you've somehow installed one library in each of them. You either need to install both libraries in both versions of python (which 2 seperate versions of pip can do), or need to setup your PYTHONPATH environment variable to allow loading of modules from additional paths (like the site-packages folder of the python 2.7.4 (64bit) installation from the python 2.7.3 executable).
0
0
0
0
2013-11-05T21:42:00.000
1
0
false
19,799,605
0
0
1
1
I have two different python programs. One of the program uses the python BeautifulSoup module, the other uses the MySQLdb module. When I run the python files individually, I have no problem and the program run fine and give me the desired output. However I need to combine the two programs so to achieve my ultimate goal. However the Beautiful soup module only runs if I open it in python 2.7.3 and the MySQLdb runs only on the python 2.7.4 (64bit) version. I installed both the modules exactly the way it was mentioned in the docs. Any help will be much appreciated.
South Migration Error
19,804,412
0
1
666
0
python,django,django-south
First thing you must run initial migration. python manage.py schemamigration --initial You are getting this error because of your project structure or there is some issue with your south package .try to remove and reinstalling south. You need to see that there should not be any extra .py file in your migration folder.
0
0
0
0
2013-11-06T03:33:00.000
2
0
false
19,803,591
0
0
1
1
I am trying to learn Django by setting up one of the projects I found on github. Afetr I ran the syncdb command it showed Not synced (use migrations): - django_extensions - djangoratings - profiles - guardian (use ./manage.py migrate to migrate these). When I am running "python manage.py migrate app" , it gives AttributeError: 'module' object has no attribute 'Migration'. I also ran schemamigration app --auto and --initial as well. But nothing seems to be working. Can somebody point out where I am going wrong.
How to set form field default value without showing the field in django forms?
65,434,713
0
4
6,103
0
python,django
if you just want to set an initial value in the form, form = MyForm(initial={'field': field_var})
0
0
0
0
2013-11-06T15:23:00.000
4
0
false
19,815,949
0
0
1
1
I'm using a forms.ModelForm to set a model's attributes. For one of the attributes, I'd like to set a default value, and I want to handle it in the form, thus no default=value on the model attribute in the model class. On the form, though, I don't want to show the user the value, not even a hidden value, therefore, I can't put the field in fields=(...) and because of that, I can't use the field.initial=value way of setting the default. I could override validation or saving methods and squeeze a attribute setting in there, but this is not what I would prefer to do. Are there any "proper" or more elegant ways of solving this problem?
phantomjs vs selenium performance
45,224,165
0
1
1,072
0
python,selenium,selenium-webdriver,phantomjs
set load images equals to false , which will definitely help you to increase the speed of phantomJS.
0
0
1
0
2013-11-06T18:50:00.000
1
0
false
19,820,306
0
0
1
1
I've been using selenium in python to drive phantomjs. The problem is that it is quite slow. I'm beginning to think that it is selenium that is slow, not the core phantomjs functionality of emulating a browser, Javascript and all. Is there a more direct way to drive phantom that is faster?
How do I register tastypie resources from external app?
19,831,689
0
1
38
0
python,django,tastypie
Turns out the clients in question override urls.py to include their apps. I replaced the API url pattern with a custom one and it seems to work.
0
0
0
0
2013-11-07T06:59:00.000
1
0
false
19,829,799
0
0
1
1
I have a django based CMS system I am working on and it uses tastypie. While all resources native to the CMS are registered in a separate file imported later into urls.py some of the clients using the system require loading their own custom apps. Is there some way to register an additional resource without changing the main codebase?
forwarding large files on servers
19,851,945
1
0
39
0
python,web-applications,flask
Yes. What would be the problem exactly? Personally I would recommend setting up an Nginx server at both ends to serve the file from the filesystem. Using Flask for hosting files is a waste of resources.
0
0
0
0
2013-11-08T03:55:00.000
1
0.197375
false
19,851,323
0
0
1
1
I have two Flask servers A and B. My user is on machine C. A is the public interface machine. The user wants to retrieve a 500GB octet-stream from B, but only the public interface on A is exposed. So I'd like something where: User on machine C sends GET request to server A, request gets routed to server B, server B replies to C with the 500GB octet-stream without going through A. Is this possible?
PyDev is installed but does not show up in ADT
19,976,691
4
3
960
0
python,eclipse,adt,pydev
The non-obvious answer here is that JDK 7 needs to be installed. Otherwise, the PyDev installation succeeds but then silently is hidden in Eclipse. I just went through this, and getting JDK 7 fixes it right up.
0
0
0
0
2013-11-08T04:47:00.000
2
1.2
true
19,851,780
1
0
1
2
I tried to setup PyDev on my ADT/eclipse. I am wondering the installation did not prompt any errors but I could not see pydev plugin after restarting ADT. Moreover I tried to extract plugin files in to eclipse>plugin folder for pydev it did not work either. Any solutions or ideas for it to work on ADT.
PyDev is installed but does not show up in ADT
19,902,911
0
3
960
0
python,eclipse,adt,pydev
You need to run Eclipse as an administartor when you do the Pydev (or any other) install.
0
0
0
0
2013-11-08T04:47:00.000
2
0
false
19,851,780
1
0
1
2
I tried to setup PyDev on my ADT/eclipse. I am wondering the installation did not prompt any errors but I could not see pydev plugin after restarting ADT. Moreover I tried to extract plugin files in to eclipse>plugin folder for pydev it did not work either. Any solutions or ideas for it to work on ADT.
Is parsing JSON on the serverside dangerous?
19,870,206
0
0
768
0
python,json
any seralizer/deserializer/parser is a potential security threat to the application It is true on the serverside as long as you write seralizer/deserializer/parser by yourself. As long as you use standard library you can trust its programmers.
0
0
0
0
2013-11-08T23:09:00.000
6
0
false
19,870,149
1
0
1
6
I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library. I've heard something along the lines that any seralizer/deserializer/parser is a potential security threat to the application Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case. Should I be paranoid along these lines of parsing JSON data from clients?
Is parsing JSON on the serverside dangerous?
19,870,208
0
0
768
0
python,json
You never know what the parser does inside. A parsing itself is a possible security threat, although the developers try to do their best to avoid it. For a stable library that's been developed for a long time, there's nearly no danger.
0
0
0
0
2013-11-08T23:09:00.000
6
0
false
19,870,149
1
0
1
6
I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library. I've heard something along the lines that any seralizer/deserializer/parser is a potential security threat to the application Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case. Should I be paranoid along these lines of parsing JSON data from clients?
Is parsing JSON on the serverside dangerous?
19,870,248
3
0
768
0
python,json
JSON data can only contain basic types: strings, numbers, Booleans, null, objects, and lists. This means that properly formatted JSON data poses no risk at all to your application, unless you are doing something silly like executing that code with eval(). So if valid JSON is not an issue, the question becomes "can a client send any invalid data that poses a security risk when processed by Python's json module". The answer here is also no, Python's json module will reliably raise a ValueError for invalid json data, with no scary side effects.
0
0
0
0
2013-11-08T23:09:00.000
6
1.2
true
19,870,149
1
0
1
6
I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library. I've heard something along the lines that any seralizer/deserializer/parser is a potential security threat to the application Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case. Should I be paranoid along these lines of parsing JSON data from clients?
Is parsing JSON on the serverside dangerous?
19,870,358
0
0
768
0
python,json
Yes. You should be paranoid. Just because the parsers are trusted does't mean you can't screw up.
0
0
0
0
2013-11-08T23:09:00.000
6
0
false
19,870,149
1
0
1
6
I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library. I've heard something along the lines that any seralizer/deserializer/parser is a potential security threat to the application Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case. Should I be paranoid along these lines of parsing JSON data from clients?
Is parsing JSON on the serverside dangerous?
19,870,379
0
0
768
0
python,json
Well... to take any user input is potentially dangerous, especially when using external libraries you don't know well. For instance, it's simple to demonstrate how a quicksort algorithm poorly implemented can be used to a Denial of Service attack by feeding it tailored data that leads all iterations to an O(n²). Does that means sort algorithms are dangerous? No. It means poor implementations of anything can be dangerous. Obviously, you should estimate the danger and benefits and choose what to adopt based on that. Frankly, if you were working on the kind of project where the potential risk of using a 3rd party json implementation is a security issue, you wouldn't be asking about it on Stack Overflow.
0
0
0
0
2013-11-08T23:09:00.000
6
0
false
19,870,149
1
0
1
6
I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library. I've heard something along the lines that any seralizer/deserializer/parser is a potential security threat to the application Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case. Should I be paranoid along these lines of parsing JSON data from clients?
Is parsing JSON on the serverside dangerous?
19,870,187
1
0
768
0
python,json
In general that blurb is true, but is dependent on how security-enabled/conscious the parser and its developers are. The json module itself has been vetted for a long time, and does not do anything that would compromise the security of the server.
0
0
0
0
2013-11-08T23:09:00.000
6
0.033321
false
19,870,149
1
0
1
6
I'm writing a Python application with Django and serializing objects to and from JSON using Python's standard json library. I've heard something along the lines that any seralizer/deserializer/parser is a potential security threat to the application Is this really true on the serverside? Do I need to fear someone sending tampered JSON up to my instance and them having remote code execution privileges? I would think that there wouldn't be any security threats other than (potentially) XSS or SQL injection, which in my case (converting values to ints, storing all data in MongoDB) shouldn't be the case. Should I be paranoid along these lines of parsing JSON data from clients?
How can a django project detect if the system has django installed?
19,883,259
1
4
262
0
python,django
Simply the module won't be found when you try to run your project. You can run 'python' in your command line and try to 'import django' if it returns an error then django isn't found it means that django isn't installed on the current machine.
0
0
0
0
2013-11-09T21:15:00.000
2
0.099668
false
19,883,186
0
0
1
1
I've built a small project on my system. After building the project, I put it on a USB drive, and copied to another system. When I run the project, how can it detect if django is installed in the system or if the system has all of the the requirements for the project? For example, I made a blog example project on a laptop, then copied that project(blog) onto a USB drive and then I copied that project(blog) to my own system. After copying, I tried to run the project. If django is installed then the project runs successfully. But when django is not installed it gives an error in the terminal. How can the program detect if the required (Django/Python) is installed or not?
How do Python developers manage Javascript/CSS library dependencies?
19,887,048
2
1
220
0
python
python is the language, I guess you mean some web platform like django. however, there is no javascript / css management tool at part of the platform.
0
0
0
0
2013-11-10T06:01:00.000
3
0.132549
false
19,886,791
1
0
1
1
Coming from C#, management of -all- dependencies was done using NuGet. In Python, PIP is used to manage python packages. Is there any de facto standard for managing Javascript and CSS library dependencies?
In which tables changes are made in openERP when an items is sold at Point of sale
19,897,059
0
0
49
1
python,openerp
All the sales done through post is registered in post.order. If you are creating orders from an external source other than pos, you can create the order in this table and call the confirm bottom action. Rest changes in all other table will be done automatically..
0
0
0
0
2013-11-10T17:46:00.000
1
0
false
19,892,934
0
0
1
1
I got one table in which modifications are made :-account_bank_statement, what other tables are needed for the point of sale and if i make a sale in which tables modifications are made.I want to make a sale but not through the pos provided.
How to use WTForms in Ajax validation?
25,145,753
3
16
8,644
0
python,flask,wtforms,flask-wtforms
A great question. This is what we do (flask backend, jquery frontend): use jquery.forms plugin to ajax forms. Pretty solid mature code. Shortcoming, cannot send json encoded data, only form-urlencoded. Receives plain or json data. use wtfroms for form validation. Very mature codebase. tried to use wtforms-json for accepting json, very screwy problems.
0
0
0
0
2013-11-11T04:42:00.000
2
0.291313
false
19,898,967
0
0
1
1
I accustomed of using WTForms by means of Flask-WTF in my flask application. Doing server side validation is trivial. But how do I leverage this server validation to become a field level, ajax, client side validation? So, when user tab to another input fields, my application can directly goes on validating it and give validation warning/info/error. I haven't found a resource in the internet yet
Over-riding Debian/Ubuntu's lintian profile
20,292,610
1
4
683
0
python,ubuntu,debian,deb,lintian
For future reference, here's what I did. I generated and packaged the .pyo files into their own tar.gz file In the postinst script, the tar.gz file is extracted, and the tar.gz file is deleted In the postrm script, the pyo files are deleted. This isn't the nicest solution in the world, but it works with Debian/Ubuntu's overly draconian policies (which don't even make sense; if I can install a binary, why not a pyo?). Hopefully this helps someone out.
0
1
0
0
2013-11-11T08:14:00.000
2
0.099668
false
19,901,647
0
0
1
1
I have written a proprietary application that needs to install some .pyo files. When I create a .deb from the app, lintian complains that package-installs-python-bytecode. I tried adding an override, but apparently this tag is marked as non-overridable by ftp-master-auto-reject.profile in /usr/share/lintian/profiles/debian. Since this tag is considered an Error, Ubuntu Software Center complains about the package. Is there a clean way to override this tag so that Ubuntu Software Center no longer complains?
where can i find the source file of 'admin.site.urls'?
21,247,209
17
11
11,132
0
python,django,django-admin,admin
In python, modules can be loaded from within a package's __init__.py; it doesn't need to be a file in the same directory. If you look in django/contrib/admin/__init__.py you will see: from django.contrib.admin.sites import AdminSite, site So then if you look in django/contrib/admin/sites.py you will see: site = AdminSite() (at the bottom) def get_urls(self): from django.conf.urls import patterns, url, include if settings.DEBUG: self.check_dependencies() def wrap(view, cacheable=False): def wrapper(*args, **kwargs): return self.admin_view(view, cacheable)(*args, **kwargs) return update_wrapper(wrapper, view) # Admin-site-wide views. urlpatterns = patterns('', url(r'^$', wrap(self.index), name='index'), url(r'^logout/$', wrap(self.logout), name='logout'), url(r'^password_change/$', wrap(self.password_change, cacheable=True), name='password_change'), url(r'^password_change/done/$', wrap(self.password_change_done, cacheable=True), name='password_change_done'), url(r'^jsi18n/$', wrap(self.i18n_javascript, cacheable=True), name='jsi18n'), url(r'^r/(?P\d+)/(?P.+)/$', wrap(contenttype_views.shortcut), name='view_on_site'), url(r'^(?P\w+)/$', wrap(self.app_index), name='app_list') ) # Add in each model's views. for model, model_admin in six.iteritems(self._registry): urlpatterns += patterns('', url(r'^%s/%s/' % (model._meta.app_label, model._meta.module_name), include(model_admin.urls)) ) return urlpatterns @property def urls(self): return self.get_urls(), self.app_name, self.name note: urls maps to get_urls()
0
0
0
0
2013-11-12T01:59:00.000
1
1
false
19,919,547
0
0
1
1
In my urls.py, I have a line of codes of ('include(admin.site.urls). But I cannot find the source file in the setup dir of python like ..\site-packages\django\contrib\admin Where are they?
How do I access my django app running on Amazon ec2?
51,827,225
0
4
6,277
0
python,django,amazon-web-services,amazon-ec2
Make sure to include your IPv4 Public IP address in the ALLOWED_HOSTS section in Django project/app/settings.py script...
0
1
0
0
2013-11-12T05:37:00.000
2
0
false
19,921,705
0
0
1
1
So, I have looked around stack overflow + other sites, but havent been able to solve this problem: hence posting this question! I have recently started learning django... and am now trying to run it on ec2. I have an ec2 instance of this format: ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com on which I have a django app running. I changed the security group of this instance to allow http port 80 connections. I did try to run it the django app the following ways: python manage.py runserver 0.0.0.0:8000 and python manage.py runserver ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com:8000 and that doesnt seem to be helping either! To make sure that there is nothing faulty from django's side, I opened another terminal window and ssh'ed into the instance and did a curl GET request to localhost:8000/admin which went through successfully. Where am I going wrong? Will appreciate any help!
is is necessary to learn java for hadoop?
19,932,204
2
2
689
0
java,python,hadoop
No, you don't necessarily need java knowledge, as you can write map-reduce jobs perfectly well in pig or hive (similar to SQL). However, as with all layers of abstraction, at some point you may well need to know what is going on "behind the scenes" and being able to look, understand and debug the underlying java is a big advantage. There is a lot of effort currently going into providing a more complete SQL interface to hadoop, with tools such as Impala (Cloudera), Presto (Facebook), Phoenix and Hive (already mentioned).
0
0
0
0
2013-11-12T14:40:00.000
3
0.132549
false
19,932,110
0
0
1
1
I wanted to start learning the big data technology from the scratch. I wanted to know is it necessary to learn java for operating with hadoop as i am already well versed in python?
django-allauth with multiple domains
21,147,716
1
3
848
0
python,django,oauth-2.0,multi-tenant,django-allauth
You should use Django sites framework together with django-allauth. Consumer keys, tokens make use of the Django sites framework. This is especially helpful for larger multi-domain projects, but also allows for for easy switching between a development (localhost) and production setup without messing with your settings and database. Just configure each social app in the admin backend.
0
0
0
0
2013-11-12T18:45:00.000
1
0.197375
false
19,937,402
0
0
1
1
I am creating a web application that will support several domains. For example, if my app were named www.webapp.com, I'd also have numerous customers mapping their domains to my site via DNS CNAME mappings, i.e. webapp.yourdomain.com CNAME www.webapp.com and foo.anotherdomain.com CNAME www.webapp.com, etc... I want users to authenticate against my app via Google or Facebook (OAuth 2.0) - without me (or the domain owners) having to create a separate Google/Facebook app per mapped domain. Ideally, I would have the base domain act as a broker and redirect to the appropriate mapped domain when responding to the callback url. For example, a user visiting webapp.yourdomain.com/accounts/facebook/login would authenticate against Facebook with a callback url going to www.webapp.com/accounts/facebook/login/callback. When processing the request, I could find the appropriate context, and redirect to webapp.yourdomain.com/accounts/facebook/login/callback where the real authentication would take place (and domain-specific auth cookies would be set). So, is this doable in django-allauth? How much hacking would it require? Or, is there another social authentication solution for Django that would be easier to implement this in?
Streaming Tweets Via Python
22,292,555
0
0
225
0
php,python,ajax,twitter,streaming
I am using twython and using long polling technique for displaying the streams.
0
0
1
1
2013-11-13T05:41:00.000
2
1.2
true
19,946,192
0
0
1
1
I am using twiiter streaming api and twython module with python 2.7 windows 7 os. I want to click a button and streaming of tweets should start. and on clicking the streaming should stop.I am using python for backend and HTML on front end.I am communicating to python via php using passthru function.when i am giving an ajax call to php on clicking of button then all the tweets is displayed at a time. I want streaming.Can anyone help?Thanks
How do I make a standalone application out of a Docker container?
19,951,847
1
5
3,690
0
python,docker
In order to use a Docker container, you will always need the basics - Docker installed on a Linux OS (that supports LXC and any other required filesystem type). In a production environment, you'd be running a recent, native install of Linux, and the initial install of Docker would be easy, and a one-time event (in a cloud environment, you'd probably not upgrade a working machine, but instead spin up a new one, with the latest pre-tested Docker version, and the equally upgraded & tested new containers). On a MacOS, or Windows development machine, you need a virtual machine to host the Linux OS. There's no way around that.
0
1
0
0
2013-11-13T09:17:00.000
3
0.066568
false
19,949,809
0
0
1
3
I'll like to create a python flask application that can run on any platform. I've put it in a Docker container. But unless I've misunderstood something the host machine still need docker installed to launch the container. Which in turn required Vagrant and and Ubuntu VM (at least on Mac). Am I missing something? What is the correct way to use a container as a standalone application?
How do I make a standalone application out of a Docker container?
20,142,281
0
5
3,690
0
python,docker
The simple answer is: you can't. The long answer is: Docker is not intended to be used to make cross platform standalone applications (but JAVA is, for example). Docker instead focuses on having a light weight container that acts like a virtual machine but basically isn't. It's just a box inside a linux(!) system that behaves like a virtual machine to install services into that can be separated clearly from each other that way. A proper use case example for docker would be to install a web application with a specific version of say apache and php in it to have a definitive environment guaranteed.
0
1
0
0
2013-11-13T09:17:00.000
3
0
false
19,949,809
0
0
1
3
I'll like to create a python flask application that can run on any platform. I've put it in a Docker container. But unless I've misunderstood something the host machine still need docker installed to launch the container. Which in turn required Vagrant and and Ubuntu VM (at least on Mac). Am I missing something? What is the correct way to use a container as a standalone application?
How do I make a standalone application out of a Docker container?
20,142,478
0
5
3,690
0
python,docker
A Linux VM is a dependency if you are on Windows or Mac. Vagrant is not though. It is mentioned only because it's probably the easiest way to get a VM up and running.
0
1
0
0
2013-11-13T09:17:00.000
3
0
false
19,949,809
0
0
1
3
I'll like to create a python flask application that can run on any platform. I've put it in a Docker container. But unless I've misunderstood something the host machine still need docker installed to launch the container. Which in turn required Vagrant and and Ubuntu VM (at least on Mac). Am I missing something? What is the correct way to use a container as a standalone application?
Django Jenkins Test runner - Slow
25,029,569
0
0
560
0
python,django,jenkins
Check the latest version of original django-jenkins library. It has same unit test discovery method and coverage disabled by default. Coverage could be enabled with --enable-coverage command line option.
0
0
0
1
2013-11-13T18:58:00.000
2
0
false
19,962,129
0
0
1
1
I am using django_discover_jenkins module for generating jenkins reports as a part of unit test runs. Has anyone used this before and found it to be slower? The coverage tasks slow this down considerably. How do I remove coverage task from the django_discover_jenkins task set without editing the settings file.
Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods
47,288,580
5
47
58,328
0
python,angularjs,flask,cors,flask-restful
Just an update to this comment. Flask CORS is the way to go, but the flask.ext.cors is deprecated. use: from flask_cors import CORS
0
0
1
0
2013-11-13T19:31:00.000
9
0.110656
false
19,962,699
0
0
1
2
I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very limited scale. I'm testing deploying my API now and I notice that the Angular clients are attempting to send an OPTIONS http methods to my Flask service. My API meanwhile is replying with a 404 (since I didn't write an OPTIONS handler yet, only a PUT handler). It seems that when sending cross-domain requests that are not POST or GET, Angular will send a pre-flight OPTIONS method at the server to make sure the cross-domain request is accepted before it sends the actual request. Is that right? Anyway, how do I allow all cross-domain PUT requests to Flask Restful API? I've used cross-domaion decorators with a (non-restful) Flask instance before, but do I need to write an OPTIONS handler as well into my API?
Flask RESTful cross-domain issue with Angular: PUT, OPTIONS methods
28,923,164
36
47
58,328
0
python,angularjs,flask,cors,flask-restful
You can use the after_request hook: @app.after_request def after_request(response): response.headers.add('Access-Control-Allow-Origin', '*') response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization') response.headers.add('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE') return response
0
0
1
0
2013-11-13T19:31:00.000
9
1
false
19,962,699
0
0
1
2
I've developed a small write-only REST api with Flask Restful that accepts PUT request from a handful of clients that can potentially have changing IP addresses. My clients are embedded Chromium clients running an AngularJS front-end; they authenticate with my API with a simple magic key -- it's sufficient for my very limited scale. I'm testing deploying my API now and I notice that the Angular clients are attempting to send an OPTIONS http methods to my Flask service. My API meanwhile is replying with a 404 (since I didn't write an OPTIONS handler yet, only a PUT handler). It seems that when sending cross-domain requests that are not POST or GET, Angular will send a pre-flight OPTIONS method at the server to make sure the cross-domain request is accepted before it sends the actual request. Is that right? Anyway, how do I allow all cross-domain PUT requests to Flask Restful API? I've used cross-domaion decorators with a (non-restful) Flask instance before, but do I need to write an OPTIONS handler as well into my API?
Autocompleting list of choices with 'other' option in django
20,029,341
0
0
59
0
jquery,python,django,autocomplete,django-forms
It would be helpful to see the model and form. If you are using a simple charfield in your model and set the choices in the automcomplete class, you should be able to input arbitrary values.
0
0
0
0
2013-11-14T03:29:00.000
1
0
false
19,968,985
0
0
1
1
I have a django form element (Musical Instrument) where I'd like to autocomplete from a list of choices (e.g. ['Piano', 'Guitar', 'Drums', 'Bass']), but allow the user to enter something else if it isn't in the list. I'm currently using autocomplete-light, but can swap this for something else if need be. Any ideas?
What's the difference between `from django.conf import settings` and `import settings` in a Django project
19,976,181
32
112
77,463
0
python,django,django-settings
from django.conf import settings is better option. I use different settings files for the same django project (one for "live", one for "dev"), the first one will select the one being executed.
0
0
0
0
2013-11-14T11:09:00.000
2
1
false
19,976,115
0
0
1
1
I'm reading up that most people do from django.conf import settings but I don't undertstand the difference to simply doing import settings in a django project file. Can anyone explain the difference?
Django tinymce safe template tag
19,978,127
2
1
500
0
python,django,django-tinymce
1) Django includes a template tag striptags to strip html tags. It uses regular expressions, it's not the right solution but it'll do the job. 2) It seems, browsing images is not included as an option in django-tinymce. You need to use another module and integrate it with TinyMCE to do the job.
0
0
0
0
2013-11-14T12:35:00.000
2
1.2
true
19,977,832
0
0
1
1
I'm currently trying django tinymce, I want to show on the main page a truncated text of around 200 characters in total. The problem is that I don't want html tags to show up nor images to show up in this truncated text.. Is there an easy way to solve it? Example: If an image is in between the 200 characters, the img tag, attribute and so on will show up and if i used the safe template tag, the image will be rendered. How should I solve this issue? should I write my own template tag and remove the images? Second problem is that I couldn't find the option to browse images from the user PC and upload it. I don't want any page to view the media, I only want to browse and upload images.
Does Django request.REQUEST.get() contain BOTH GET and POST parameters?
41,547,619
1
6
8,947
0
python,django,post,get
Try this: name = request.GET.get('name', request.POST.get('name'))
0
0
0
0
2013-11-14T17:22:00.000
4
0.049958
false
19,984,224
0
0
1
2
Are the parameters in request.POST and request.GET BOTH in request.REQUEST ? Or i have to check for each of them ? I can't find a clear info in the documentation for both REQUEST/QueryDict. NB: Django 1.4 Final
Does Django request.REQUEST.get() contain BOTH GET and POST parameters?
19,984,347
1
6
8,947
0
python,django,post,get
Yes, the doc says: HttpRequest.REQUEST For convenience, a dictionary-like object that searches POST first, then GET. Inspired by PHP’s $_REQUEST. For example, if GET = {"name": "john"} and POST = {"age": '34'}, REQUEST["name"] would be "john", and REQUEST["age"] would be "34". It’s strongly suggested that you use GET and POST instead of REQUEST, because the former are more explicit.
0
0
0
0
2013-11-14T17:22:00.000
4
0.049958
false
19,984,224
0
0
1
2
Are the parameters in request.POST and request.GET BOTH in request.REQUEST ? Or i have to check for each of them ? I can't find a clear info in the documentation for both REQUEST/QueryDict. NB: Django 1.4 Final
Is a web2py project typically made up of multiple applications?
19,988,936
0
0
97
0
python,web,web2py
In most cases, a website is probably a single web2py application, though that doesn't have to be the case (a web2py installation can include multiple applications, which can interact with each other). An application itself can be composed of multiple re-usable plugins (similar to how a Django project can be made up of multiple apps). Each application typically has its own database (or even multiple databases) and sessions, though both databases and sessions can be shared across applications if desired.
0
0
0
0
2013-11-14T19:36:00.000
1
0
false
19,986,721
0
0
1
1
web2py beginner. In django, a project is typically made up of multiple applications that encapsulate project functions, right? Do web2py projects typically have the same structure or is the entire website just a single application?
Google AppEngine: Setting up user roles and permissions
20,210,524
0
1
874
0
python,google-app-engine,permissions,roles,app-engine-ndb
You must manage user_profile yourself. In your user_profile, you can store the user id such as an email address or a google user id like you want. Add a role array in this entity where you store all roles for this user and you manage access with decorators. For example, users which are employers will have "EMPLOYERS" in their roles and you manage access to the job creation handler with a @isEmployer decorator. With this solution, you can assign many roles for you user like "ADMIN" in the future.
0
1
0
0
2013-11-14T21:21:00.000
3
0
false
19,988,654
0
0
1
2
I am undergoing Udacity's Web Development course which uses Google AppEngine and Python. I would like to set up specific user roles, and their alloted permissions. For example, I may have two users roles, Employer and SkilledPerson, and assign their permissions as follows: Only Employers may create Job entities. Only SkilledPerson may create Resume and JobApplication entities. How do I do this? How do I define these user roles? How do I assign a group of permissions to specific roles? How do I allow users to sign up as a particular role (Employer or SkilledPerson)?
Google AppEngine: Setting up user roles and permissions
20,207,381
0
1
874
0
python,google-app-engine,permissions,roles,app-engine-ndb
I'd create a user_profile table which stores their Google user id, and two Boolean fields for is_employer and is_skilled_person, because there's always potential for someone to be both of these roles on your site. (Maybe I'm an employer posting a job but also looking for a job as well) If you perceive having multiple roles and a user can only be one role, I'd make it a string field holding the role name like "employer", "admin", "job seeker" and so on.
0
1
0
0
2013-11-14T21:21:00.000
3
0
false
19,988,654
0
0
1
2
I am undergoing Udacity's Web Development course which uses Google AppEngine and Python. I would like to set up specific user roles, and their alloted permissions. For example, I may have two users roles, Employer and SkilledPerson, and assign their permissions as follows: Only Employers may create Job entities. Only SkilledPerson may create Resume and JobApplication entities. How do I do this? How do I define these user roles? How do I assign a group of permissions to specific roles? How do I allow users to sign up as a particular role (Employer or SkilledPerson)?