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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
How does Flask know to load the views.py in the Visual Studio default Flask Solution? | 29,791,283 | 1 | 0 | 251 | 0 | python,visual-studio,flask | In Flask it is usually enough to import the files the routed functions are defined in. You can add your API methods in an other file and import it. Make sure you don't have any circular imports, they are a source of problem in Flask quite often.
If things are getting more complex, it's best to use Blueprints to bundle ... | 0 | 0 | 0 | 0 | 2015-04-22T07:56:00.000 | 1 | 1.2 | true | 29,791,175 | 0 | 0 | 1 | 1 | I'm using the Python Tools for Visual Studio (PTVS 2.2 Beta) and creating a new Flask Web Project with Visual Studio 2013. (btw I'm new to both Flask and Python...)
The views.py contains my routes. How does VS know to load this file? I don't see it in any properties or other files. Is it a default to always have th... |
why would a django test fail only when the full test suite is run? | 47,938,881 | 1 | 31 | 8,341 | 0 | python,django,unit-testing | Another possibility is that you've disconnected signals in the setUp of a test class and did not re-connect in the tearDown. This explained my issue. | 0 | 0 | 0 | 0 | 2015-04-22T08:56:00.000 | 6 | 0.033321 | false | 29,792,439 | 0 | 0 | 1 | 1 | I have a test in Django 1.5 that passes in these conditions:
when run by itself in isolation
when the full TestCase is run
when all of my app's tests are run
But it fails when the full test suite is run with python manage.py test. Why might this be happening?
The aberrant test uses django.test.Client to POST some da... |
Is there a service that can use google api to monitor changes in google spreadsheet? | 29,799,548 | 1 | 0 | 736 | 0 | javascript,google-apps-script,google-api,google-api-python-client | Here is a way to do it without triggers/onEdit and without polling the spreadsheet api. Beware this is hacky but it has the advantage of not using apps script quotas or spreadsheet api quotas to detect changes1) in the spreadsheet enable email notifications whenever the spreadsheet changes.2) using gmail filters send t... | 0 | 0 | 0 | 0 | 2015-04-22T11:43:00.000 | 1 | 0.197375 | false | 29,796,483 | 0 | 0 | 1 | 1 | I am very new to JavaScript and Google app script. I want to monitor changes in a sheet. And if there is an edit, I want a script function to run. Triggers are not an option here to use because they have small quota limit. So I can not use onEdit or time driven triggers to call my function. I need some service to use G... |
Django 1.7 - allow null and blank in the database, but do not allow null or blank in admin form | 29,798,581 | 0 | 0 | 41 | 0 | django,python-3.x | We did this just by change the Model field to not allow null/blank and add default value, and also write a script to add default value to the already existed data whose field is null/blank. | 0 | 0 | 0 | 0 | 2015-04-22T13:03:00.000 | 2 | 0 | false | 29,798,471 | 0 | 0 | 1 | 2 | I have a database where I have older entries which contain null/blank values for a specific field. However, from now on, I would like to not allow null/blank values to be added to the database.
Is there a way to do this in Django 1.7, python 3.4. |
Django 1.7 - allow null and blank in the database, but do not allow null or blank in admin form | 29,798,580 | 1 | 0 | 41 | 0 | django,python-3.x | There's really no such thing as blank in the database, or null in the admin. null controls whether the database can contain NULL values (not even empty values, just NULL). blank controls whether the admin and modelforms accept empty values.
It seems to me that what you want is simply null=True, blank=False. | 0 | 0 | 0 | 0 | 2015-04-22T13:03:00.000 | 2 | 1.2 | true | 29,798,471 | 0 | 0 | 1 | 2 | I have a database where I have older entries which contain null/blank values for a specific field. However, from now on, I would like to not allow null/blank values to be added to the database.
Is there a way to do this in Django 1.7, python 3.4. |
Change the order in which Django migrate app during testing | 29,814,121 | 1 | 7 | 2,278 | 0 | python,django,testing,migration | Put your your apps before Django apps in INSTALLED_APP in settings.py file | 0 | 0 | 0 | 0 | 2015-04-22T13:18:00.000 | 2 | 0.099668 | false | 29,798,841 | 0 | 0 | 1 | 1 | I am using the custom user model which inherits from the AbstractBaseUser class. When I try to migrate after makemigrations command
django.db.utils.ProgrammingError: relation "custom_user_users" does not exist
This is happening since Django is trying to migrate other apps first which depends upon the custom user mod... |
django filer no module named fields.image error | 29,804,634 | 2 | 0 | 809 | 0 | python,django | You most likely have a Python file called filer.py or a Python module (folder containing a __init__.py file) called filer in your current directory (or somewhere in your PYTHON_PATH) which shadows the filer package you installed.
You need to remove or rename that file/module in order to be able to use the filer package... | 0 | 0 | 0 | 0 | 2015-04-22T15:42:00.000 | 1 | 1.2 | true | 29,802,546 | 0 | 0 | 1 | 1 | I have this problem. I have installed filer and when I import only filer its fine import filer
It is importing but when I do from filer.fields.image import FilerImageField
It is not importing and gives error no module named fields.image
What is the problem? I have gone through the documentation and it gives the same w... |
Will using memcache reduce my instance memory? | 29,806,800 | 3 | 0 | 130 | 1 | python-2.7,google-app-engine,memcached | Moving objects to and from Memcache will have no impact on your memory unless you destroy these objects in your Java code or empty collections.
A bigger problem is that memcache entities are limited to 1MB, and memcache is not guaranteed. The first of these limitations means that you cannot push very large objects into... | 0 | 1 | 0 | 0 | 2015-04-22T18:48:00.000 | 1 | 1.2 | true | 29,806,384 | 0 | 0 | 1 | 1 | I'm currently running into soft memory errors on my Google App Engine app because of high memory usage. A number of large objects are driving memory usage sky high.
I thought perhaps if I set and recalled them from memcache maybe that might reduce overall memory usage. Reading through the docs this doesn't seem to ... |
Djangos TEMPLATE_DIRS not found | 29,813,856 | 0 | 4 | 717 | 0 | python,django,templates | Well it is not a good solution, but try hardcoding the full path. | 0 | 0 | 0 | 0 | 2015-04-23T00:13:00.000 | 2 | 0 | false | 29,811,281 | 0 | 0 | 1 | 1 | I am trying to create a login page in my django application. I created a "templates" folder on the root directory of my application.
Then on my settings.py I wrote this code.
TEMPLATE_DIRS = (os.path.join(BASE_DIR,'templates'),)
And it is giving this feedback:
TemplateDoesNotExist at /login/
Template-loader postmort... |
Django: thin model to consume XML API? | 29,970,413 | 0 | 0 | 65 | 0 | python,xml,django,django-models | Judging by the deafening silence, I gather the answer is: do it differently.
We're rebuilding the project to consume a JSON ReSTful interface instead. | 0 | 0 | 0 | 0 | 2015-04-23T03:13:00.000 | 1 | 1.2 | true | 29,812,987 | 0 | 0 | 1 | 1 | A software architecture question:
I have the top two/thirds of a Django app: the view and template layers. I'd like to use an external resource for the model. How?
I'd like to use as much of the Django model layer as possible, for the ORM. The external resource is a specialized Java package, providing content via a f... |
Recommended way to build cross platform desktop application using linux development machine | 29,815,298 | 1 | 2 | 1,133 | 0 | python,linux,windows | What you are looking for is a GUI tool-kit with bindings to python. Tkinter is the de facto standard for python GUI and is cross platform. Qt is also a popular choice but the license is more restrictive then Tkinter but will allow you to transition into C++ programming with Qt easier if that is something you may want t... | 0 | 1 | 0 | 0 | 2015-04-23T04:57:00.000 | 2 | 0.099668 | false | 29,814,020 | 0 | 0 | 1 | 1 | I am pretty familiar with building web based apps using python django on my linux machine. But when I decided to try my hand at building desktop applications that can run on windows/linux I didn't know where to begin.
I know I can surely build windows desktop application on windows machine. But I am pretty comfortable ... |
how to change the subject for Django error reporting emails? | 42,911,596 | 3 | 7 | 1,862 | 0 | python,django | If you need it only for reporting errors the best choice would be to inherit from the django.utils.log.AdminEmailHandler and override the def format_subject(self, subject): method.
Note that changing EMAIL_SUBJECT_PREFIX will affect not only error emails but all emails send to admins including system information email... | 0 | 0 | 0 | 0 | 2015-04-24T05:56:00.000 | 2 | 0.291313 | false | 29,839,766 | 0 | 0 | 1 | 1 | i noticed about to change the subject for django error reporting emails,
is it possible to change subject?
can we modify the subject for Django error reporting emails ? |
what metric should I monitor for a spider in scrapy | 29,871,881 | 0 | 0 | 161 | 0 | python,scrapy | Your question doesn't compute, because the answer depends solely on your specific use case and the goal of your scraping. The criteria/metric of spiders success is directly derived from your business logic. Just take a step back and ask yourself, what do I want to achieve with this spider? When you answer that, the met... | 0 | 0 | 0 | 0 | 2015-04-24T10:40:00.000 | 1 | 1.2 | true | 29,845,345 | 0 | 0 | 1 | 1 | To make sure everything is working properly, what metric should I monitor for a general spider?
Currently, I'll monitor
the number of item returned. E.g. the percentage change should be less than 1%
the number of error in log file. E.g. the error number should be zero
is it enough for a general spider? |
App engine Datastore cache or memcache | 29,846,381 | 1 | 0 | 290 | 0 | python,google-app-engine | The 'Datastore caching' you refer to is implemented using memcache under the hood anyway, so you won't gain from additional explicit caching of these entities.
Python's ndb API and Java's Objectify both provide memcache-based automated caching for exactly this scenario. Of course, you can still use memcache independen... | 0 | 1 | 0 | 0 | 2015-04-24T10:56:00.000 | 1 | 1.2 | true | 29,845,685 | 0 | 0 | 1 | 1 | I have read that the datastore read request in the App engine get cached and subsequent reads performed on the same entity are fast.
So if i read an entity from datastore, are there any tangible benefits of storing the entity in the memcache explicitly for later fetches? Or would the datastore caching serve with suffic... |
GAE: how to get current server IP? | 29,846,170 | 0 | 0 | 157 | 0 | python,google-app-engine | I'm not entirely clear on what you're looking for, but you can retrieve that type of information from the WSGI environmental variables. The method of retrieving them varies with WSGI servers, and the number of variables made available to your application depends on the web server configuration.
That being said, gettin... | 0 | 1 | 0 | 0 | 2015-04-24T11:08:00.000 | 1 | 0 | false | 29,845,940 | 0 | 0 | 1 | 1 | I'm hosting my app on Google App Engine. Is there any posibility to get server IP of my app for current request?
More info:
GAE has a specific IP addressing. All http requests go to my 3-level domain, and IP of this domain isn't fixed, it changes rather frequently and can be different on different computers at the same... |
Django way for multiple translations for one language or parametrize translations | 29,846,744 | -1 | 3 | 521 | 0 | python,django,internationalization,translation | I assume that you are using Django to create an API, and you consume the API with javascript. You can check the user-agent string from the header and make the appropriate redirect according to the request. | 0 | 0 | 0 | 0 | 2015-04-24T11:41:00.000 | 3 | -0.066568 | false | 29,846,606 | 0 | 0 | 1 | 1 | I have django app which is backend for javascript application intended for multiple TV devices. Each device has different frontend but I don't think that creating multiple .po files is good idea for this goal, because most of translations are repetitive for these devices.
Is this possible to add additional parameters f... |
Nginx/Uwsgi log showing duplicate requests | 29,899,664 | 0 | 1 | 602 | 0 | python,flask,uwsgi | Sorry false alarm. This was my Devops incorrectly pinging my actual application route for heartbeat. Sorry for the confusion. | 0 | 1 | 0 | 0 | 2015-04-24T14:49:00.000 | 1 | 1.2 | true | 29,850,613 | 0 | 0 | 1 | 1 | I'm running a flask application using nginx and uwsgi and I noticed when I tail the logs for uwsgi it looks like its just constantly polling my app when I'm doing nothing. It also seems like it's cycling through the cores on my machine with each request so I see this in the logs.
[pid: 27182|app: 0|req: 557/784] {26 v... |
Model.objects.get returns nothing | 29,882,375 | 0 | 0 | 57 | 1 | python,django,object,get,models | I solved it by using transaction.commit() before my second query. | 0 | 0 | 0 | 0 | 2015-04-24T18:00:00.000 | 1 | 1.2 | true | 29,854,433 | 0 | 0 | 1 | 1 | I'm having this weird problem when using
Model.objects.get(op1=1,op2=2)
it raises the does not exist error although it exists. Did that ever happen with anyone?
I even checked in my logs to make sure that the log happened when the id already existed in the database.
[2015-04-24 20:18:21,106] ERROR: Couldn't find the... |
Webapp2 Redirect Method | 29,866,631 | 2 | 1 | 177 | 0 | python,google-app-engine,webapp2 | Use a 307 redirect. A 307 will not change the method of the redirect.
Wikipedia: 307 temporary redirect (provides a new URL for the browser to resubmit a GET or POST request) | 0 | 1 | 0 | 0 | 2015-04-25T14:09:00.000 | 1 | 1.2 | true | 29,866,234 | 0 | 0 | 1 | 1 | I am trying to redirect a POST request from an Google App Engine Python Handler to another URL. The Problem is that it seems the method is changed to GET. Is there any way to set the POST method when redirecting? |
Unable to create a file on Ubuntu server using Flask and Python | 29,876,936 | 0 | 0 | 170 | 0 | python,apache,flask | Solved it by giving absolute path. I was trying all combinations of paths and also gave absolute path /var/www/arxiv/static/data/name.json and it worked. | 0 | 0 | 0 | 0 | 2015-04-26T10:10:00.000 | 1 | 0 | false | 29,876,315 | 1 | 0 | 1 | 1 | I am using f = open('name.json','w+') to create a new file and write to it. But i am unable to create the file. Apache server logs show "No such file exists." |
Is it possible to maintain a reusable django *project* across apps? | 31,610,217 | 0 | 0 | 98 | 0 | python,django,git | A possibility, as suggested, is templating the project which could suffice. However, templating projects would result in a different starting point for every project. Since templates evolve over time there's not one project that starts the same.
Having a baseline throughout all your projects seems only worth pursuing i... | 0 | 0 | 0 | 0 | 2015-04-26T11:11:00.000 | 1 | 1.2 | true | 29,876,874 | 0 | 0 | 1 | 1 | I'm trying to decide whether underneath 'reusable apps' it is doable to maintain a reusable bare project setup as well.
On a side note: I can destroy any of my servers and rebuild it in barely hours as long as I have a (data) backup and a blueprint (in my case saltstack, but it might just as well be puppet, chef or wha... |
How to export a schedule to Google Calendar? | 29,885,432 | 1 | 0 | 186 | 0 | python,django,google-calendar-api | You can export it as CSV, much easier, and Google calendar supports it as Import format | 0 | 0 | 0 | 0 | 2015-04-27T00:42:00.000 | 1 | 1.2 | true | 29,885,414 | 0 | 0 | 1 | 1 | I'm writing an app in Django, I would like to be able to allow users to export an event schedule to Google Calendar.
I was thinking about exporting the schedule to an iCal file, but I would have to use some unpopular third party libraries, which sounds like a lot of trouble. Does Django have a functionality like that? |
Yes/No message box in Odoo | 42,901,463 | 0 | 0 | 3,798 | 0 | python,messagebox,odoo | You can do one thing. Call a form view using button (type="action"). In form view footer, keep your button. On clicking on the button do your desired operation.
NB: Your form view model should be different. Should not be same as current view. | 0 | 0 | 0 | 0 | 2015-04-27T06:48:00.000 | 2 | 0 | false | 29,888,975 | 0 | 0 | 1 | 1 | I would like to show a message box with 'text', 'Yes' and 'No' button. If users click 'Yes', to continue the method work.
How could I add this alert message box in my Odoo by Python?
If you have any idea, please share me.
Thanks. |
ODOO, calendar.event : bool have no attribute replace | 29,891,572 | 0 | 0 | 823 | 0 | python-2.7,calendar,odoo,odoo-8 | Is your field used for 'display_start' on your view has a default value on your model ?
I think it's because it returns False for this field you have this error. If it returns today, I think it will be ok. | 0 | 0 | 0 | 0 | 2015-04-27T07:59:00.000 | 1 | 1.2 | true | 29,890,204 | 0 | 0 | 1 | 1 | I extends class calendar_event for add status with statusbar. It's work perfectly when i update an event BUT when i tried to create i've a problem :
Traceback (most recent call last):
File "/home/x/workspace/Odoo8/openerp/http.py", line 530, in _handle_exception
return super(JsonRequest, self)._han... |
How to manage django and flask application sharing one database model? | 29,890,773 | 2 | 6 | 3,757 | 1 | python,django,flask,sqlalchemy | Firstly, don't do this; you're in for a world of pain. Use an API to pass data between apps.
But if you are resigned to doing it, there isn't actually any problem with migrations. Write all of them in one app only, either Django or Alembic and run them there. Since they're sharing a database table, that's all there is ... | 0 | 0 | 0 | 0 | 2015-04-27T08:25:00.000 | 2 | 0.197375 | false | 29,890,684 | 0 | 0 | 1 | 1 | I have two repository written in flask and django.
These projects sharing the database model which is written in SQLAlchemy in flask and written in Django ORM.
When I write migration script in flask as alembic, How can django project migrates with that script?
I also think about Django with SQLAlchemy. But I can't fin... |
Django: How to automatically change a field's value at the time mentioned in the same object? | 29,903,655 | -1 | 18 | 13,168 | 0 | python,django,django-models,celery,django-celery | Is there any reason you wouldn't just calculate the boolean field in your business logic? i.e. when you receive a request related to that race, simply check the times and assess whether or not the race is active (for display, analysis), etc.
I'm assuming you won't have high load (one reason for pre-processing) like th... | 0 | 0 | 0 | 0 | 2015-04-27T18:18:00.000 | 5 | -0.039979 | false | 29,903,134 | 0 | 0 | 1 | 1 | I am working on a django project for racing event in which a table in the database has three fields.
1)Boolean field to know whether race is active or not
2)Race start time
3)Race end time
While creating an object of it,the start_time and end_time are specified. How to change the value of boolean field to True when the... |
Webapp architecture: Putting python in a MEAN stack app | 36,828,297 | 1 | 1 | 1,124 | 0 | python,angularjs,mongodb,frameworks,mean-stack | To answer my own question about a year later, what I would do now is just run my python script in tiny web server that lived on the same server as my MEAN app. It wouldn't have any external ports exposed and the MEAN app would just ping it for information and get JSON back. Just in case anyone is looking at this questi... | 0 | 0 | 0 | 0 | 2015-04-27T18:31:00.000 | 1 | 0.197375 | false | 29,903,381 | 0 | 0 | 1 | 1 | I currently have a small webapp on AWS based on the MEAN (Mongo, Express, Angular, Node) but have a python script I would like to execute on the front end. Is there a way to incorporate this? Basically, I have some data objects on my AngularJS frontend from a mongoDB that I would like to manipulate with python and do... |
Cannot upload to an app ID though I have the correct permissions | 29,906,509 | 0 | 0 | 30 | 0 | python,google-app-engine,console,cloud | Most likely, you are logged into Gmail under a different account. Go to Gmail, and click Sign Out. Then go to the developer console. It should ask you to log in or select from several accounts. | 0 | 1 | 0 | 0 | 2015-04-27T19:01:00.000 | 1 | 0 | false | 29,903,889 | 0 | 0 | 1 | 1 | (I've been using appengine since 2009 and haven't needed support until now.) I've been added to a new project from the cloud console. When I try to upload the app, AppEngine launcher says "This application does not exist". Furthermore, in Cloud console, nothing appears under the appengine heading. At the same time, h... |
Running node, PHP and Python on the same vps | 29,909,359 | 1 | 0 | 789 | 0 | php,python,node.js,ubuntu,nginx | The kind of setup you're describing is straightforward and not complicated. Nginx works fine as a reverse proxy and web server that handles serving static assets.
For PHP, you just need to proxy to php-fpm (running on a TCP port or unix socket).
For Python, you need a wsgi server (something like uwsgi or gunicorn, aga... | 0 | 0 | 0 | 1 | 2015-04-27T22:10:00.000 | 1 | 0.197375 | false | 29,906,888 | 0 | 0 | 1 | 1 | Is there a rational way to serve multiple websites via PHP:Nginx, Python:??? & node.js on the same vps?
And would it be reliable?
The sites are expected to be low in traffic.
I currently have PHP running on Nginx, Ubuntu via Digital Ocean and I would like to stick to Nginx for PHP and any major webserver for Python. |
Cannot import Beautiful Soup | 57,754,599 | 0 | 18 | 46,868 | 0 | python,beautifulsoup | The best way to resolve is, while creating your interpreter select your global python path on your system(/usr/local/bin/python3.7).
Make sure that in pycharm shell, python --version appears as 3.7. It shouldn't show 2.7 | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 54,489,766 | 1 | 18 | 46,868 | 0 | python,beautifulsoup | One of the possible reason: If you have more than one python versions installed and let's say you installed beautifulsoup4 using pip3, it will only be available for import when you run it in python3 shell. | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0.013333 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 53,284,293 | 3 | 18 | 46,868 | 0 | python,beautifulsoup | Copy bs4 and beautifulsoup4-4.6.0.dist-info from C:\python\Lib\site-packages to your local project directory. It worked for me. Here, python actually looks for the library in local directory rather than the place where the library was installed! | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0.039979 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 52,847,210 | 3 | 18 | 46,868 | 0 | python,beautifulsoup | I experienced a variation of this problem and am posting for others' benefit.
I named my Python example script bs4.py
Inside this script, whenever trying to import bs4 using the command:
from bs4 import BeautifulSoup, an ImportError was thrown, but confusingly (for me) the import worked perfectly from an interactive sh... | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0.039979 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 72,153,534 | 0 | 18 | 46,868 | 0 | python,beautifulsoup | For me it was a permissions issue. Directory "/usr/local/lib/python#.#/site-packages/bs4" was only 'rwx' by root and no other groups/users. Please check permissions on that directory. | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 59,960,168 | 5 | 18 | 46,868 | 0 | python,beautifulsoup | Make sure the directory from which you are running your script does not contain a filename called bs4.py. | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0.066568 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 69,835,809 | 0 | 18 | 46,868 | 0 | python,beautifulsoup | I had the same problem. The error was that the file in which I was importing beautifulsoup from bs4 was in another folder. Just replaced the file out of the internal folder and it worked. | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 61,982,622 | 0 | 18 | 46,868 | 0 | python,beautifulsoup | There is no problem with package just need to Copy bs4 and
beautifulsoup4-4.6.0.dist-info into your project directory | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 51,398,896 | 0 | 18 | 46,868 | 0 | python,beautifulsoup | I was also facing this type error in the beginning even after install all the modules which were required including pip install bs4 (if you have installed this then no need to install beautifusoup4 | BeautifulSoup4 through pip or anywhere else it comes with bs4 itself)
Solution : Just go to your python file where it is... | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 70,643,924 | 0 | 18 | 46,868 | 0 | python,beautifulsoup | For anyone else that might have the same issue as me. I tried all the above, but still didn't work. issue was 1 was using a virtual environment so needed to do pip install in the pycharm terminal instead of a command prompt to install it there. Secondly I had typed import Beautifulsoup with the S not capitalized. chang... | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 0 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 29,924,863 | 17 | 18 | 46,868 | 0 | python,beautifulsoup | The issue was I named the file HTMLParser.py , and that name is already used somewhere in the bs4 module.
Thanks to everyone that helped! | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 1.2 | true | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Cannot import Beautiful Soup | 60,569,945 | 6 | 18 | 46,868 | 0 | python,beautifulsoup | I found out after numerous attempts to solve the ImportError: cannot import name 'BeautifulSoup4' that the package is actually called BeautifulSoup so the import should be:
from bs4 import BeautifulSoup | 0 | 0 | 1 | 0 | 2015-04-27T22:57:00.000 | 15 | 1 | false | 29,907,405 | 0 | 0 | 1 | 12 | I am trying to use BeautifulSoup, and despite using the import statement:
from bs4 import BeautifulSoup
I am getting the error: ImportError: cannot import name BeautifulSoup
import bs4 does not give any errors.
I have also tried import bs4.BeautifulSoup and just importing bs4 and creating a BeautifulSoup object with: ... |
Avoid duplicate entries in Datastore | 29,918,649 | 2 | 1 | 456 | 0 | python-2.7,google-app-engine,google-cloud-datastore,webapp2 | Hash the entities and use the hash value as the key for your Entity. | 0 | 1 | 0 | 0 | 2015-04-28T09:34:00.000 | 1 | 0.379949 | false | 29,915,632 | 0 | 0 | 1 | 1 | I am trying to send the data to google app engine in python using Webapp2, But when I check the entries in the data in console I found duplicate entries which means except Id everything is same.I want to avoid those duplicate entries.Please suggest me if there is anyway to find the duplicate values to avoid.Thanks in a... |
Socket communication with Django | 29,916,039 | 1 | 0 | 409 | 0 | python,django | You can use with django any python packages as with any "normal" python program. If you have a module, that communicate with your server, you can use this, if not, you have to write one on your own possibly with socket programming. | 0 | 0 | 1 | 0 | 2015-04-28T09:45:00.000 | 1 | 1.2 | true | 29,915,865 | 0 | 0 | 1 | 1 | Is it possible to use Django for communication with some kind of server process? For example on my Django website I want to have form where I input connection details (host and port) and after connection I want to send some request or events to other server process (some simple action like slider moving or clicking a b... |
Display progress of a long running Python task in Django | 29,927,235 | 1 | 2 | 1,205 | 0 | python,django,celery,django-celery | My first suggestion is to psychologically separate celery from django when you start to think of the two. They can run in the same environment, but celery is to asynchronous processes what django is to http requests.
Also remember that celery is unlike diango in that it requires other services to function; a message b... | 0 | 0 | 0 | 0 | 2015-04-28T18:13:00.000 | 1 | 0.197375 | false | 29,926,911 | 0 | 0 | 1 | 1 | I currently have a typical Django structure set up for a project and one web application.
The web application is set up so that a user inputs some information, and this information is taken as the input to run a Python program.
This python program sometimes can take quite a while to finish (grabbing things from the w... |
GAE module: "Request attempted to contact a stopped backend." | 29,928,760 | 0 | 2 | 607 | 0 | python,google-app-engine | Fixed by shutting down all instances (on all modules/versions just to be safe). | 0 | 1 | 0 | 0 | 2015-04-28T19:42:00.000 | 1 | 1.2 | true | 29,928,477 | 0 | 0 | 1 | 1 | I am currently experiencing an issue in my GAE app with sending requests to non-default modules. Every request throws an error in the logs saying:
Request attempted to contact a stopped backend.
When I try to access the module directly through the browser, I get:
The requested URL / was not found on this server.
I... |
Displaying pyqtgraph and pyqt widgets on web | 29,947,088 | 0 | 4 | 1,640 | 0 | python,django,pyqt,saas,pyqtgraph | Here is what I have sort of put together by pulling several threads online:
Ruby On Rails seems to be more popular than python at this moment.
If you go python, Flask and Django are good templates.
bokeh seems to be a good way of plotting to a browser.
AFAIK, there is no way to take an existing PyQt or pyqtgraph appl... | 1 | 0 | 0 | 0 | 2015-04-28T19:43:00.000 | 2 | 1.2 | true | 29,928,485 | 0 | 0 | 1 | 2 | Is there a way to take existing python pyqtgraph and pyqt application and have it display on a web page to implement software as a service? I suspect that there has to be a supporting web framework like Django in between, but I am not sure how this is done.
Any hints links examples welcome. |
Displaying pyqtgraph and pyqt widgets on web | 29,987,875 | 0 | 4 | 1,640 | 0 | python,django,pyqt,saas,pyqtgraph | If all you need are static plots, then it should be straightforward to draw and export to an SVG file, then display the SVG in a webpage (or export to image, as svg rendering is not reliable in all browsers). If you need interactivity, then you're going to need a different solution and probably pyqtgraph is not the too... | 1 | 0 | 0 | 0 | 2015-04-28T19:43:00.000 | 2 | 0 | false | 29,928,485 | 0 | 0 | 1 | 2 | Is there a way to take existing python pyqtgraph and pyqt application and have it display on a web page to implement software as a service? I suspect that there has to be a supporting web framework like Django in between, but I am not sure how this is done.
Any hints links examples welcome. |
Django rest framework: correctly handle incoming array of model ids | 29,935,296 | 2 | 1 | 116 | 0 | python,django,rest,django-rest-framework | Consider the upvote button to the left. When you click it, a request may be sent to stackoverflow.com/question/12345/upvote. It creates an "action resource" on the db, so later you can go to your user profile and check out the list of actions you took.
You can consider doing the same thing for your application. It may ... | 0 | 0 | 0 | 0 | 2015-04-29T05:38:00.000 | 1 | 0.379949 | false | 29,935,200 | 0 | 0 | 1 | 1 | I have a question about REST design in general and specifically what the best way to implement a solution is in Django Rest Framework. Here it the situation:
Say I have an app for keeping track of albums that the user likes. In the browser, the user sees a list of albums and each one has a check box next to it. Chec... |
Remove # from the URL in Python Simple HTTP Server | 29,939,768 | 0 | 0 | 1,156 | 0 | python,angularjs,http,simplehttpserver | Well i had a similar problem but the difference is that i had Spring on the Server Side.
You can capture page not found exception at your server side implementation, and redirect to the default page [route] in your app. In Spring, we do have handlers for page not found exceptions, i guess they are available in python t... | 0 | 0 | 0 | 0 | 2015-04-29T09:08:00.000 | 3 | 0 | false | 29,939,110 | 0 | 0 | 1 | 1 | I have an angularjs app that uses Angular UI Router and the URL that are created have a # in them.. Eg. http://localhost:8081/#/login. I am using Python Simple HTTP server to run the app while developing. I need to remove the # from the URL. I know how to remove it by enabling HTML5 mode in angular. But that method has... |
How does Heroku handle Django dependencies? | 29,954,119 | 2 | 0 | 86 | 0 | python,django,heroku | Heroku only uses the libraries in your requirements.txt file. Whatever version of Django is specified there is what it will install. | 0 | 0 | 0 | 0 | 2015-04-29T18:47:00.000 | 4 | 0.099668 | false | 29,952,053 | 0 | 0 | 1 | 1 | I'm starting to work on my first-ever Django/Heroku project – I'm working on a friend's web app that's already partially coded. It's built in Django 1.6. There's no virtualenv, and when I clone it and try to run it in Django 1.8 it crashes and burns. The app itself is currently online and functional, and when I run the... |
How to use a model from a Django project in another Python script | 29,953,247 | 0 | 0 | 1,229 | 0 | python,django | You can use sql alchemy
You can add the mainscript as part of the django project
You can serve content using Django Rest Framework, the database connection happens when you access through manage.py, the table is available to anyone with permissions.
tl:dr; You need a connection to said database | 0 | 0 | 0 | 0 | 2015-04-29T19:45:00.000 | 3 | 0 | false | 29,953,112 | 0 | 0 | 1 | 1 | I have a directory which contains a Django project with a models.py in which I have defined some models. I have another directory somewhere else and which has a Python script. In this script I would like to import one of the models "Foo" from models.py.
With the table "Foo", I want to create entries, update, get, etc... |
How to track anonymous users with Flask | 30,008,742 | 4 | 7 | 2,806 | 0 | python,flask,flask-login,anonymous-users | You can use a AnonymousUserMixin subclass if you like, but you need to add some logic to it so that you can associate each anonymous user with a cart stored in your database.
This is what you can do:
When a new user connects to your application you assign a randomly generated unique id. You can write this random id to... | 0 | 0 | 0 | 0 | 2015-04-30T07:44:00.000 | 2 | 0.379949 | false | 29,961,898 | 0 | 0 | 1 | 2 | My app implements a shopping cart in which anonymous users can fill their cart with products. User Login is required only before payment. How can this be implemented?
The main challenge is that flask must keep track of the user (even if anonymous) and their orders. My current approach is to leverage the AnonymousUserMi... |
How to track anonymous users with Flask | 29,962,315 | 9 | 7 | 2,806 | 0 | python,flask,flask-login,anonymous-users | There is no need for a custom AnonymousUserMixin, you can keep the shopping cart data in session:
anonymous user adds something to hist cart -> update his session with the cart data
the user wants to check out -> redirect him to login page
logged in user is back at the check out -> take his cart data out of the sessio... | 0 | 0 | 0 | 0 | 2015-04-30T07:44:00.000 | 2 | 1 | false | 29,961,898 | 0 | 0 | 1 | 2 | My app implements a shopping cart in which anonymous users can fill their cart with products. User Login is required only before payment. How can this be implemented?
The main challenge is that flask must keep track of the user (even if anonymous) and their orders. My current approach is to leverage the AnonymousUserMi... |
WebSockets best practice for connecting an external application to push data | 29,967,827 | 0 | 2 | 704 | 0 | python,websocket | It depends on your software design, if you decide the logic from WebSocketServer.px and CoreApplication.py belongs together, merge it.
If not, you need some kind of inter process communication (ipc).
You can use websockets for this ipc, but i would suggest, you use something simpler. For example, you can you json-rpc... | 0 | 0 | 1 | 0 | 2015-04-30T12:19:00.000 | 1 | 0 | false | 29,967,612 | 0 | 0 | 1 | 1 | I am trying to understand how to use websockets correctly and seem to be missing some fundamental part of the puzzle.
Say I have a website with 3 different pages:
newsfeed1.html
newsfeed2.html
newsfeed3.html
When a user goes to one of those pages they get a feed specific to the page, ie newsfeed1.html = sport, news... |
Running Python script in Django from submit | 68,890,513 | -1 | 8 | 37,522 | 0 | python,django,django-forms | python manage.py <your_script_name>
Here script name is ur python file .No need to mention .py extenstion. | 0 | 0 | 0 | 0 | 2015-04-30T20:46:00.000 | 6 | -0.033321 | false | 29,977,495 | 0 | 0 | 1 | 1 | Perhaps there is a different way of going about this problem, but I am fairly new to using Django.
I have written a custom Python script and would like to run a function or .py file when a user presses a "submit" button on the webpage.
How can I get a parameter to be passed into a Python function from a submit button u... |
Django syncdb on first deployment | 29,980,168 | 0 | 1 | 300 | 0 | python,django,deployment,django-models | syncdb has been changed to migrate since django 1.7
Migrations
New in Django 1.7.
Migrations are Django’s way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema. They’re designed to be mostly automatic, but you’ll need to know when to make migrations, when... | 0 | 0 | 0 | 0 | 2015-04-30T22:26:00.000 | 2 | 0 | false | 29,978,859 | 0 | 0 | 1 | 1 | So I've managed to create a site with django 1.8 and I'm ready to deploy. I have several new models and I'm using django-allauth which has it's own models. I've also managed to make changes to settings with a config file to use different databases for production and development as well as turning off debug when it's pr... |
Generating new SQLite database django | 66,293,699 | 3 | 7 | 5,560 | 1 | python,django,web | When you have no database in your project, a simple python manage.py migrate will create a new db.sqlite3 file. | 0 | 0 | 0 | 0 | 2015-05-01T17:30:00.000 | 2 | 0.291313 | false | 29,991,871 | 0 | 0 | 1 | 1 | I had a duplicate sqlite database. I tried deleting the duplicate but instead deleted both. Is there a way I can generate a new database? The data was not especially important. |
PyCharm integrated debugger slows down application | 30,017,850 | 3 | 5 | 2,048 | 0 | python,performance,debugging,pycharm | The way to get fast debugging sessions in PyCharm (Professional edition) is to use remote debugging, similar to pdb.set_trace().
In the Run/Debug Configurations dialogue, create a Remote Debug configuration. The dialogue contains the instructions, which I will repeat here completeness sake:
Add pycharm-debug.egg from ... | 0 | 0 | 0 | 0 | 2015-05-02T18:04:00.000 | 1 | 0.53705 | false | 30,005,704 | 1 | 0 | 1 | 1 | I am using PyCharm to debug a moderately complex Pyramid web application with a lot of dependencies. When I run the application inside PyCharm using PyCharm's Debug run, the application start up slows down significantly. This kills the normal web application workflow of edit, save, refresh. The slowdown is significant,... |
Python script fallback to second server | 30,035,305 | 1 | 1 | 104 | 0 | python,pushbullet | Could you shutdown the script on your VPS, copy the cache files over the the Pi and run the script there? Then do the reverse when you want to move it back to the VPS.
You could possibly run the script on both systems, but then you'd need to synchronize between them which sounds like a lot of unnecessary work. For in... | 0 | 1 | 0 | 1 | 2015-05-03T02:24:00.000 | 1 | 0.197375 | false | 30,009,595 | 0 | 0 | 1 | 1 | I have a Python script that manages Pushbullet channels for Nexus Android device factory images. It runs on my VPS (cron job that runs every 10 minutes), but my provider has warned that there may be intermittent downtime over the next several days. The VPS is running Ubuntu Server 15.04.
I have a Raspberry Pi that's al... |
Why are my imports no longer working? | 30,010,724 | 5 | 5 | 299 | 0 | python,google-app-engine,pycharm,wtforms | Try deleting the libraries from your project if they are in libraries, then re-importing those libraries.
Also, I assume you've done this, but make sure the libraries are actually installed and present in a reachable location that is properly mapped. | 0 | 0 | 0 | 0 | 2015-05-03T05:40:00.000 | 2 | 0.462117 | false | 30,010,620 | 1 | 0 | 1 | 2 | I refactored my webapp and now my IDE pycharm marks some imports red. Why?
from wtforms import Form, TextField, validators, SelectField
My IDE marks the Form, TextField and the SelectField red as they cannot be imported. ("Unresolved reference"). What should I do if I need those classes in my project? |
Why are my imports no longer working? | 30,010,736 | 3 | 5 | 299 | 0 | python,google-app-engine,pycharm,wtforms | You need to install it in in your environment(according to the comments you didn't), please try the following:
Settings -> Project: MyProjectName -> Project Interpreter
Then click on the green plus and choose your packages | 0 | 0 | 0 | 0 | 2015-05-03T05:40:00.000 | 2 | 1.2 | true | 30,010,620 | 1 | 0 | 1 | 2 | I refactored my webapp and now my IDE pycharm marks some imports red. Why?
from wtforms import Form, TextField, validators, SelectField
My IDE marks the Form, TextField and the SelectField red as they cannot be imported. ("Unresolved reference"). What should I do if I need those classes in my project? |
Django/apache handle incomplete/cancelled http requests | 30,021,032 | 7 | 4 | 5,582 | 0 | python,django,apache,http | When reading request content, if the required length of content had not been read, then the WSGI layer would when wsgi.input.read() was called raise an IOError exception. This may be passed on as is in Django, or in more recent versions be changed to a different derived IOError exception type called UnreadablePostError... | 0 | 0 | 0 | 0 | 2015-05-03T22:42:00.000 | 1 | 1.2 | true | 30,020,226 | 0 | 0 | 1 | 1 | When django is deployed on apache with mod_wsgi. It seems to handle incomplete or cancelled requests in a very odd way.
If the client cancels the request, the cancelled request is not cancelled on django, for example, if you are uploading a big file, obviously the body of the request will be actually streamed, so while... |
Clickable links in terminal output | 40,915,552 | 1 | 4 | 3,643 | 0 | python,python-3.x,hyperlink,pycharm | As outlined above, you need to use a terminal that supports clicking of URL's.
On linux, most terminals do this. Ex Gnome-terminal, terminator etc..
On Mac, try iterm2. | 0 | 0 | 1 | 0 | 2015-05-04T09:35:00.000 | 1 | 0.197375 | false | 30,026,870 | 0 | 0 | 1 | 1 | My python program outputs a set of url links. When I run this on pycharm, I can directly click on the links and that will open them up in the browser. However, when I run the python file by double clicking on the .py file, the links are not clickable. I want the links to be clickable so it takes me to the browser direc... |
How to handle session and token based authentication simultaneously using middle ware in django? | 30,053,316 | 3 | 2 | 755 | 0 | python,django,django-rest-framework,django-authentication,http-token-authentication | In my case I have written custom middle-ware to handle the situation.
1. When I am login using API and api path is **/api/accounts/login**. So when request comes on this url then I am removing sessionid and csrftoken both.
When HTTP_AUTHORIZATION is available in request, I remove the session and csrftoken.
Using above ... | 0 | 0 | 0 | 0 | 2015-05-05T08:55:00.000 | 2 | 1.2 | true | 30,048,364 | 0 | 0 | 1 | 1 | I want to use both token and session based authentication in my application with the priority of token. I have created two portal with the same URL one is using session and other is using token. So when session is available in cookie then token based request goes failed with "CSRF Token is missing" error message.
One s... |
What is better: projectcontrib.pluginname or project-pluginname as a python project naming convention for small project? | 30,057,386 | 0 | 1 | 43 | 0 | python,pep8 | At the end of the day, whats more important is consistency within your own code. Its important that your convention be constant. Or if you are coding with a group that your convention be consistent across your project.
With that said, each language will have its own Style Guides. Style Guides offer consistency across t... | 0 | 0 | 0 | 0 | 2015-05-05T15:34:00.000 | 1 | 1.2 | true | 30,057,321 | 1 | 0 | 1 | 1 | I created a small project on Python. Main app use some plugins. I would like to know which naming convention for namespaces is better? PEP-0423 recommends to use "project" namespace for main program and "projectcontrib.pluginname" for plugins. But django or node.js often use "project-pluginname" convention. What are pr... |
Django Rest Framework and Angular | 30,067,648 | 0 | 1 | 292 | 0 | javascript,python,django,angularjs,django-rest-framework | I think the second one is better. In a restful-style project, front-end code is completely decouple with the back-end code.
Besides, separate them into two projects is good for deployment. If you want to upgrade the front-end code, just upload them and restart nginx, front-end code totally is static. | 0 | 0 | 0 | 0 | 2015-05-06T03:46:00.000 | 1 | 0 | false | 30,067,124 | 0 | 0 | 1 | 1 | I am very new to Django Rest Framework (DRF) and AngularJs. What I wandering here is the best way to work with these two.
DRF and AngularJs together (Most of tutorials showed me this) in one project
DRF as backend and AngularJs in frontend as 2 different projects
I am very confused, though I feel the 2nd approach is ... |
Python: Selenium send_key can't type numbers like 5 or 6 | 66,779,985 | 0 | 6 | 4,525 | 0 | python,selenium | As dear @Epiwin mentioned ,it is a horrible bug in TightVNC or combination of chrome driver and it, I've removed it completely and install TigerVNC instead and eventually it worked.
BTW, I don't know why! but the speed of the remote connection increased after migrate to TigerVNC, and it was another good point for mine. | 0 | 0 | 1 | 0 | 2015-05-06T10:07:00.000 | 7 | 0 | false | 30,073,603 | 0 | 0 | 1 | 1 | So I see this issue on google selenium site but it has not been resolved yet.
when you element.send_key('12345')
it will return '123'. The 5 is parsed as backspace....
is there a work around for this?
Using latest selenium, chrome, chromedriver, python 2.7, ubuntu 12.04 |
Organising common code in django/python | 30,156,768 | 1 | 1 | 214 | 0 | python,django | There is no problem with having helpers, but I think you chose wrong naming strategy. The name of the module or package should tell you what function it performs.
In your case you should name your helpers after the job they help you do. For example, StringHelpers or UrlUtils. | 0 | 0 | 0 | 0 | 2015-05-06T12:05:00.000 | 1 | 0.197375 | false | 30,076,216 | 0 | 0 | 1 | 1 | Sometimes we need in auxiliary functions, classes etc.
Sometimes we put such entities into modules or packages.
Currently I have three variants:
Use helpers package or module.
Use utils package or module (like in Java).
Don't use something like it because it is anti pattern. If you have helpers then you have a applica... |
View error Can't find field 'blocked' in the following view parts composing the view of object model | 52,777,087 | 0 | 0 | 410 | 0 | python,postgresql,openerp,openerp-7 | If you have frontend or backend instances. Make sure that:
All code match in both instances
Update your module
check if column exist in your table | 0 | 0 | 0 | 0 | 2015-05-06T14:36:00.000 | 1 | 0 | false | 30,079,853 | 0 | 0 | 1 | 1 | I have migrated my OpenERP 7.0 DB from dev to production and now everytime I try to create a new customder, I get this error:
View error Can't find field 'blocked' in the following view parts composing the view of object model 'res.partner':
res.partner.followup.form.inherit Either you wrongly customized this
vie... |
Deploying websites in django virtual machine | 30,089,080 | 0 | 0 | 460 | 0 | python,django,postgresql,deployment,web-deployment | From my point of view, database always should be created before deployment. And the information of the database must be posted to the settings.py
for the application it self, I think virtualenv can be very helpful in these cases with requirements.txt
You run the application in your virtual environment and then export y... | 0 | 0 | 0 | 0 | 2015-05-06T22:30:00.000 | 2 | 0 | false | 30,088,815 | 0 | 0 | 1 | 1 | Sorry I'm new to this specific topic.
I have a website implemented in django and AskBot it also has a DB (postgreSQL). I want to create a deployment package which can be distributed to any customer; such that this customer can have their own server. Taking into consideration that the deployment package should be platfo... |
Summary or toc for autoflask Sphinx | 30,135,026 | 2 | 3 | 539 | 0 | python,flask,python-sphinx,tableofcontents | Turns out there is an html file which gets generated in the build folder called http-routingtable.html which does what I'm asking above. Given the purpose of sphinx (documentation) you would think this would be... documented... clearly. Hopefully others experiencing the problem run across this post in the future. | 0 | 0 | 0 | 0 | 2015-05-07T08:10:00.000 | 2 | 1.2 | true | 30,095,337 | 0 | 0 | 1 | 1 | We use Sphinx to document our Flask API. It does a pretty good job, but we are having a problem navigating the documentation it generates.
We document each blueprint separately. Our blueprints are pretty big. Each is about 1000 lines long, and our docstrings are extremely detailed. The result is a Sphinx page which lis... |
Indicate a specific .mo file for Babel to load | 30,123,126 | 0 | 2 | 116 | 0 | python,flask,webapp2,python-babel | Solved by just using the flask app and the way I wanted to avoid - on every request, there is a callback to the app instance and to the localeselector decorator, language is set previously in an attribute in flask.g. Basically, by the books I guess. | 0 | 0 | 0 | 0 | 2015-05-07T12:08:00.000 | 1 | 0 | false | 30,100,641 | 0 | 0 | 1 | 1 | The setup of the problem is simple enough:
an user selects a language preference (this preference can be read from the user’s session);
based on this choice, load the appropriate .mo from the available translations;
(no separate domains are set up, if it makes any difference)
Problem: since this return has to be done... |
Python/Django IDE for Solaris | 30,108,350 | 1 | 0 | 535 | 0 | python,django,ide,solaris | I'd suggest use www.pythonanywhere.com
You can build and host your Django app there for free, it supports Python 2.7 and 3.4, most recent Django versions ( 1.4 to 1.8) and has virtualenv support so you can change whatever you like. It even comes preloaded with many useful libraries.
It doesn't support text completion i... | 0 | 0 | 0 | 0 | 2015-05-07T17:38:00.000 | 2 | 0.099668 | false | 30,108,107 | 0 | 0 | 1 | 1 | Could anyone tell me a well-round Python & Django IDE fully compatible with Solaris?. I'm only aware of Netbeans but as far as I know It does not have support for Django and it lacks also of important features for Python like code completion.
Thank you very much |
Detecting incorrect nesting of XML tags in Python | 30,114,393 | 1 | 0 | 79 | 0 | python,xml,nested | Make an empty stack.
Iterating through the list:
if you find a start tag, push it onto the stack.
if you find an end tag, compare it to the entry on top of the stack.
if the stack is empty or the top doesn't match, fail.
if it matches, pop the stack and continue.
At the end of the iteration:
if the stack is empt... | 0 | 0 | 1 | 0 | 2015-05-08T00:54:00.000 | 2 | 1.2 | true | 30,114,069 | 0 | 0 | 1 | 1 | A question about testing proper nesting of XML tags:
I got a list of tags, extracted from top to bottom from an xml file:
Closing tags are clearly indicated by forward slash
/to and /lastname tags are incorrectly nested. They should be switched. /lastname should be within to, /to parent tags.
tag_list = ['note', 'to'... |
Scaling a decoupled realtime server alongside a standard webserver | 30,188,812 | 1 | 2 | 559 | 0 | python,websocket,real-time,scalability | If the scenario is
a) The main web server raises a message upon an action (let's say a record is inserted)
b ) He notifies the appropriate real-time server
you could decouple these two steps by using an intermediate pub/sub architecture that forwards the messages to the indended recipient.
An implementation would be
... | 0 | 0 | 1 | 0 | 2015-05-08T01:26:00.000 | 4 | 1.2 | true | 30,114,325 | 0 | 0 | 1 | 2 | Say I have a typical web server that serves standard HTML pages to clients, and a websocket server running alongside it used for realtime updates (chat, notifications, etc.).
My general workflow is when something occurs on the main server that triggers the need for a realtime message, the main server sends that message... |
Scaling a decoupled realtime server alongside a standard webserver | 30,170,295 | 0 | 2 | 559 | 0 | python,websocket,real-time,scalability | Changed the answer because a reply indicated that the "main" and "realtime" servers are alraady load-balanced clusters and not individual hosts.
The central scalability question seems to be:
My general workflow is when something occurs on the main server that triggers the need for a realtime message, the main server s... | 0 | 0 | 1 | 0 | 2015-05-08T01:26:00.000 | 4 | 0 | false | 30,114,325 | 0 | 0 | 1 | 2 | Say I have a typical web server that serves standard HTML pages to clients, and a websocket server running alongside it used for realtime updates (chat, notifications, etc.).
My general workflow is when something occurs on the main server that triggers the need for a realtime message, the main server sends that message... |
Flask-Admin vs Flask-AppBuilder | 30,292,629 | 32 | 13 | 8,504 | 0 | python,flask,flask-admin | I am the developer of Flask-AppBuilder, so maybe a strong bias here. I will try to give you my most honest view. I do not know Flask-Admin that much, so i will probably make some mistakes.
Flask-Admin and Flask-AppBuilder:
Will both give you an admin interface for Flask with bootstrap.
Will both make their best to get... | 0 | 0 | 0 | 0 | 2015-05-08T14:44:00.000 | 2 | 1.2 | true | 30,126,607 | 0 | 0 | 1 | 1 | I am new to Flask and have noticed that there are two plugins that enable CRUD views and authorized login, Flask-Admin and Flask-AppBuilder.
These two features interest me along with nice Master-Detail views for my model, where I can see both the rows of the master table and the relevant details on the same screen.
Any... |
Unable to import python module 'web'? | 53,768,539 | 0 | 1 | 83 | 0 | python,python-2.7,module,web.py | Sometimes the problem is in the PYTHONPATH, and the IDE modify the environment variables so when you run it from there you don't have a problem. | 0 | 0 | 1 | 0 | 2015-05-10T18:54:00.000 | 1 | 0 | false | 30,155,400 | 1 | 0 | 1 | 1 | I am trying to import the web module of python to create a simple Hello World program on my browser using web.py.
When I run it from the command line I am getting errors about the web.py package. If I run it from IDLE, it works fine. |
I don't need django tables by default | 30,164,129 | 3 | 2 | 1,066 | 0 | python,django,django-models | Just don't include (or comment out) the middleware or apps that you don't need. While the MIDDLEWARE_CLASSES setting is required to be present...it doesn't need to contain the authentication middleware.
In other words, keep MIDDLEWARE_CLASSES and INSTALLED_APPS in your settings.py, but remove the middleware classes and... | 0 | 0 | 0 | 0 | 2015-05-11T09:29:00.000 | 3 | 0.197375 | false | 30,164,030 | 0 | 0 | 1 | 1 | Here is my question, I have to do a new django project but I don't need the database tables that django offers by default, auth_user, table... etc. Is there any way for start a project synchronizing the database but without all this stuff?
I have tried to comment the INSTALLED_APPS by default and MIDDLEWARE_CLASSES bu... |
Apache2 doesn't work after installing mod-wsgi | 30,165,117 | 1 | 0 | 256 | 0 | python,django,apache2,debian,mod-wsgi | >>> a2dismod python did the trick. Mod-wsgi 4.0+ doesn't work with mod-python. | 0 | 0 | 0 | 1 | 2015-05-11T09:52:00.000 | 1 | 1.2 | true | 30,164,528 | 0 | 0 | 1 | 1 | I have installed libapache2-mod-wsgi on a Debian 8 64 bit server. Whenever I loaded the domain before this install, the default page for apache2 loaded. But after the install it shows The webpage is not available error, the same error occurs when there is no internet connection on my PC. I have tried a2dismod wsgi to d... |
In Django, is it better to add admin features to the command line or the admin interface? | 30,180,570 | 0 | 1 | 48 | 0 | python,django,django-admin,email | I sugest You to stick to the web interface if it will be used by a human. CLI is good when You want to control Your application by another app or some sort of script.
Many people could have a problem using CLI. Remember that potential client will almost always be 'less technical' person than You, so the UI should be us... | 0 | 0 | 0 | 0 | 2015-05-12T01:52:00.000 | 1 | 0 | false | 30,180,448 | 0 | 0 | 1 | 1 | In my specific case, I'm building a relatively straightforward email-sending webapp. I'll need to add the ability for a human to generate email templates from the last day's worth of updated objects, view the day's last sent emails, etc.
Django provides the Django manage.py CLI, and also the Django Admin Web UI. Both ... |
Returning cursor isn't retrieving data from DB | 30,181,819 | 0 | 0 | 24 | 1 | python-2.7,postgresql-9.3 | If you close the connection, you cannot iterate a cursor anymore. There is no connection to the database. | 0 | 0 | 0 | 0 | 2015-05-12T03:52:00.000 | 1 | 0 | false | 30,181,471 | 0 | 0 | 1 | 1 | cursor.execute(sql_statement)
conn.close()
return cursor
the above are the closing lines of my program. I've 3 html pages (users, workflows, home), returning curosor is triggering data for workflows and home page, but not for users page
Where as, if i do return cursor.fetchall(), then it's working for all 3 pages.
Th... |
how to upload the existing app in to web2py environment | 30,356,551 | 0 | 2 | 724 | 0 | python,web2py | Just use the file system.
GUI:
Copy your application folder to your new instance of web2py (/web2py/applications).
Command line:
scp -r /home/username/oldarea/web2py/application/myApp /home/username/newarea/web2py/applications | 0 | 1 | 0 | 0 | 2015-05-13T07:31:00.000 | 1 | 0 | false | 30,208,421 | 0 | 0 | 1 | 1 | I am new to web2py I have web2py application in my local system i want to upload this application into web2py environment throught admin interface option present in web2py Upload & install packed application and do some modifications and run the application but i am unable to uploded the app please give the suggesatio... |
Send a XML file with authorization to a django app | 30,215,688 | 0 | 0 | 238 | 0 | python,xml,django,curl | request.body should contain the XML as string.
I tried using curl, but the data I get on the Django side becomes a
dictionary
Can you please share the code blocks to receive/print the data? | 0 | 0 | 1 | 0 | 2015-05-13T13:00:00.000 | 1 | 1.2 | true | 30,215,568 | 0 | 0 | 1 | 1 | How can I send an xml file to a Django app server from a command line interface?
I tried using curl, but the data I get on the Django side becomes a dictionary and doesn't look like xml. In addition to that I need some basic authorization mechanism. I tried curl examples, but to no avail. Maybe I am expecting the wron... |
Server architecture depending on the capacity | 30,222,997 | 0 | 0 | 117 | 0 | python,websocket,server,capacity | One of solutions could be Pyramid, sockjs, gunicorn, and gevent. Nginx probably better suits to be a frontend than Apache, but of course if you do not have any lengthy processing on the backend, any decent asynchronous Python server with websocket and sockjs support (not sure about socket.io as an alternative) will wor... | 0 | 0 | 1 | 0 | 2015-05-13T17:39:00.000 | 2 | 0 | false | 30,221,772 | 0 | 0 | 1 | 1 | I am new at Server side,
but I have gotten a chance to design and implement a server that will cover around 2000~3000 client.
And I am thinking that I will use Python and Websocket, though I don't know this choice is appropriate.
In this point, I am curious on how to design the server.
I think there must be some archit... |
Django createsuperuser cannot enter password | 71,642,770 | 0 | 1 | 3,933 | 0 | python,django,superuser | The password is usually hidden in your IDE so it is not showing up when you're typing it out.
Just type the password press enter and re-enter the same thing.
Hope this solves the problem. | 0 | 0 | 0 | 0 | 2015-05-15T01:19:00.000 | 3 | 0 | false | 30,250,032 | 0 | 0 | 1 | 2 | I am learning django, and I have a mysite folder. When I synced the database it prompted me to create a superuser. I typed yes, and got halfway through the forms but I couldn't enter any characters when it wanted a password. I searched google and found:
python manage.py createsuperuser
The same thing happened, I co... |
Django createsuperuser cannot enter password | 70,849,579 | -1 | 1 | 3,933 | 0 | python,django,superuser | Operations to perform:
Apply all migrations: admin, admin_interface, auth, contenttypes, myapp, sessions
Running migrations:
Applying myapp.0002_alter_student_id... | 0 | 0 | 0 | 0 | 2015-05-15T01:19:00.000 | 3 | -0.066568 | false | 30,250,032 | 0 | 0 | 1 | 2 | I am learning django, and I have a mysite folder. When I synced the database it prompted me to create a superuser. I typed yes, and got halfway through the forms but I couldn't enter any characters when it wanted a password. I searched google and found:
python manage.py createsuperuser
The same thing happened, I co... |
pisa.CreatePDF hangs with huge html file | 30,345,810 | 1 | 2 | 1,230 | 0 | python,django,pdf,pisa | I did few changes in html which results pisa.createPDF works fast for me.
I am using html of almost 2 MB, contains single table with almost more than 10,000 rows. So I break them into multiple tables and tried again. Its surprised me, initially with single table it took almost 40 minutes (2590 seconds) to generate PDF ... | 0 | 0 | 0 | 0 | 2015-05-15T06:14:00.000 | 2 | 0.099668 | false | 30,252,726 | 0 | 0 | 1 | 1 | I am generating pdf using html template with python pisa.CreatePDF API,
It works well with small html, but in case of huge html it takes lot of time. Is there any alternative ? |
Run multiple Celery chains at the same time | 30,300,802 | 1 | 0 | 678 | 0 | python,django,celery | If you want to run chains at once you will need to run more than one worker. | 0 | 1 | 0 | 0 | 2015-05-15T19:21:00.000 | 1 | 1.2 | true | 30,267,236 | 0 | 0 | 1 | 1 | I have Celery tasks chain that I call with apply_async. Each task in chain depends on the result from previous task.
Basically the worklof looks like this:
Fetch data from DB.
For each fetched row run chain with tasks.
Behaviour that I want to achieve is to run multiple chains at one time. But it seems like it runs t... |
Distributed Task Queue Based on Sets as a Data Structure instead of Lists | 30,282,486 | 1 | 8 | 656 | 0 | python,redis,rabbitmq,celery,message-queue | Can your tasks in stage 2 check whether the work has already been done and, if it has, then not do the work again? That way, even though your task list will grow, the amount of work you need to do won't.
I haven't come across a solution re the sets / lists, and I'd think there were lots of other ways of getting around ... | 0 | 1 | 0 | 0 | 2015-05-16T16:26:00.000 | 3 | 0.066568 | false | 30,278,054 | 0 | 0 | 1 | 1 | I'm wondering if there's a way to set up RabbitMQ or Redis to work with Celery so that when I send a task to the queue, it doesn't go into a list of tasks, but rather into a Set of tasks keyed based on the payload of my task, in order to avoid duplicates.
Here's my setup for more context:
Python + Celery. I've tried Ra... |
Is there a way to run a Google App engine cron task without hitting an endpoint but rather pointing cron.yaml at a python script? | 30,280,609 | 2 | 0 | 622 | 0 | python,google-app-engine,google-cloud-storage | A cron job in GAE has to hit a URL, there's no other way to do it. That's just how the system is designed.
But since you have control over app.yaml anyway, you can easily assign your script to a URL there. | 0 | 1 | 0 | 1 | 2015-05-16T20:32:00.000 | 2 | 0.197375 | false | 30,280,460 | 0 | 0 | 1 | 1 | my end goal is to update Google cloud storage with some json data and I would rather it run a script rather than hitting a url endpoint. What would be the proper configuration of cron.yaml if, let's say the script were to sit right next to app.yaml? |
Equivalent of javadoc's tags in pydoc | 30,287,331 | 1 | 0 | 1,176 | 0 | python,pydoc | I ended up just switching to epydoc, which is much more featureful than pydoc. Sphinx is another alternative. | 0 | 0 | 0 | 0 | 2015-05-17T12:43:00.000 | 2 | 1.2 | true | 30,286,986 | 0 | 0 | 1 | 1 | In javadoc, you can have tags like @author, @return, @deprecated which are handled specially when making java documentation. Is there an equivalent functionality in pydoc or am I limited to just a verbatim copy of the method's docstring? |
Where to save messages in Django app? | 30,289,765 | 0 | 0 | 435 | 0 | python,django,django-messages | It depends. You could save your messages in the database if you need the classical approach to messages. This would best work for messages sent in e-mail or bulletin board "style".
If however you need real-time behavior and lots of messages, having a database inbetween might slow things down a bit. You could use node.j... | 0 | 0 | 0 | 0 | 2015-05-17T16:45:00.000 | 1 | 1.2 | true | 30,289,423 | 0 | 0 | 1 | 1 | I want to make my own on Django-app. The app must have an messages-application not only for notification but for chatting between users.
So, for example I've write a model for messages, so where I have to save the messages? In the database, or maybe it is not a good style of coding and bad for work speed? |
Weasyprint HTML to PDF huge gap in right margin | 30,314,963 | 0 | 0 | 1,861 | 0 | python,css,django,pdf,weasyprint | Found the solution. It was a CSS problem. The class used to style the body was not at the beginning of the css file and that caused erratic behavior with other styles declared before it. | 0 | 0 | 0 | 0 | 2015-05-17T22:03:00.000 | 1 | 1.2 | true | 30,292,625 | 0 | 0 | 1 | 1 | I'm using Weasyprint to print an HTML template to PDF, and I keep getting a gap of 10cm on the right side.
I'm using @page:(size:letter;) as only page attribute.
I've tried setting the page size manually, but I still keep getting a huge space to the right of all the pages.
Any thoughts on what could be the problem? |
how to give some unique id to each anonymous user in django | 30,298,038 | 7 | 8 | 4,523 | 1 | python,django,authentication | I think you should use cookies.
When a user that is not authenticated makes a request, look for a cookie named whatever ("nonuserid" in this case). If the cookie is not present it means it's a new user so you should set the cookie with a random id. If it's present you can use the id in it to identificate the anonymous ... | 0 | 0 | 0 | 0 | 2015-05-18T07:52:00.000 | 2 | 1.2 | true | 30,297,785 | 0 | 0 | 1 | 1 | I want to create a table(postgres) that stores data about what items were viewed by what user. authenticated users are no problem but how can I tell one anonymous user from another anonymous user? This is needed for analysis purposes.
maybe store their IP address as unique ID? How can I do this? |
Find out Python version from source code (or Heroku) | 30,321,377 | 0 | 1 | 1,237 | 0 | python,django,heroku,version | If you didn't have access to source code, from headers I can see that server is using Gunicorn 0.17.2, which is compatible with Python 2.x >= 2.6, which rules out i.e. Python 3. | 0 | 0 | 0 | 0 | 2015-05-19T08:20:00.000 | 4 | 0 | false | 30,320,265 | 1 | 0 | 1 | 1 | We run a site called inteokej.nu and I need to find out which version of Python it runs on. I have pulled all the files to my computer but I don't know if and how I can find out the version number from them? The site is hosted on Heroku and maybe there's a way to find out the version with some kind of Heroku command?
A... |
Django - Cannot find Directory 'mysite' | 30,326,360 | 0 | 0 | 1,391 | 0 | python,django,windows-7-x64 | To Summarize the comments:
This is because you're in c:\Windows\system32. By default when you open command prompt is in that system32 directory. you need to change it first. To change directory use cd <what path you want>.
Once you're in the correct directory, you can start the project with django-admin startproject c... | 0 | 0 | 0 | 0 | 2015-05-19T11:47:00.000 | 1 | 1.2 | true | 30,324,761 | 0 | 0 | 1 | 1 | I am currently learning how to use Python/Django. I have successfully installed and setup Django. I am experiencing problems creating a project using the django-admin startproject mysite command. I have executed the command from command prompt using the path: C:\Python34\Scripts\django-admin startproject mysite I tried... |
GoogleScraper keeps searches in database | 30,433,834 | 0 | 0 | 192 | 1 | python,bash,web-scraping | I solved the issue which keeps searches in GoogleScraper database,we first have to run following command
GoogleScraper --clean
This command cleans all cache and we can search again with new results.
Regards! | 0 | 0 | 1 | 0 | 2015-05-20T10:54:00.000 | 1 | 1.2 | true | 30,347,571 | 0 | 0 | 1 | 1 | I am using GoogleScraper for some automated searches in python.
GoogleScraper keeps search results for search queries in its database named google_scraper.db.e.g. if i have searched site:*.us engineering books and due to internet issue while making json file by GoogleScraper.If the result is missed and json file is not... |
Breakpoints not working for Django Project with python environment 2.7 in Visual Studio with PTVS | 30,482,731 | 0 | 0 | 627 | 0 | python,django,python-2.7,debugging,ptvs | Managed to fix the error myself. What I had done was create a project "From Existing Python code". Instead I created a new Django Web Project in Visual Studio and then deleted all files that Visual Studio automatically added.
Then I included my old Django-files in the project and the breakpoints started working. Don't ... | 0 | 0 | 0 | 0 | 2015-05-21T07:26:00.000 | 1 | 1.2 | true | 30,367,194 | 0 | 0 | 1 | 1 | I get the following errors when I try to set a breakpoint for html files in a Django project:
"A breakpoint could not be inserted at this location"
"This is not a valid location for a breakpoint"
In .py files I can set breakpoints but they will not get hit.
If I make a new Djnago project the breakpoints can be set ... |
Python / Django | How to store sent emails? | 30,369,384 | 2 | 3 | 559 | 0 | python,django | Another way to look at it: send the mail to your backup email account ex: backup@yourdomain.com. So you can store the email, check if the email is sent or not.
Other than that, having an extra model for logged emails is a way to go. | 0 | 0 | 0 | 1 | 2015-05-21T08:22:00.000 | 3 | 0.132549 | false | 30,368,271 | 0 | 0 | 1 | 2 | I was wondering how can I store sent emails
I have a send_email() function in a pre_save() and now I want to store the emails that have been sent so that I can check when an email was sent and if it was sent at all. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.