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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Edit database outside Django ORM | 35,273,897 | 3 | 7 | 670 | 1 | python,django,git,postgresql | The migrations system does not look at your current schema at all. It builds up its picture from the graph of previous migrations and the current state of models.py. That means that if you make changes to the schema from outside this system, it will be out of sync; if you then make the equivalent change in models.py an... | 0 | 0 | 0 | 0 | 2016-02-08T15:31:00.000 | 2 | 0.291313 | false | 35,273,294 | 0 | 0 | 1 | 1 | If one is using Django, what happens with changes made directly to the database (in my case postgres) through either pgadmin or psql?
How are such changes handled by migrations? Do they take precedence over what the ORM thinks the state of affairs is, or does Django override them and impose it's own sense of change hi... |
Is jupyter replicating my data to a cloud server | 35,287,484 | 2 | 1 | 392 | 0 | python,jupyter,jupyter-notebook | Jupyter uses no cloud services, and should make no external requests when you are running it locally. The best way to think of a local install of Jupyter notebook is a desktop application that happens to use your web browser for its UI. It talks to the local filesystem, and relays that data to your browser over HTTP on... | 0 | 0 | 0 | 0 | 2016-02-08T20:12:00.000 | 1 | 0.379949 | false | 35,278,437 | 1 | 0 | 1 | 1 | This is a pretty simple question. I if you download jupyter as a part of Anaconda. How is your data being secured. When I run jupyter it does go straight to an html page, but that page displays my local folders on the servers I am connected to.
If I make a notebook, will that notebook be stored on a cloud server. Wh... |
"scrapy list" command in my project directory starts a spider | 35,303,023 | 0 | 1 | 383 | 0 | python,python-2.7,web-scraping,scrapy | The code was printing some print statements that made it delay the response which made me think it was crawling. | 0 | 0 | 0 | 0 | 2016-02-08T21:27:00.000 | 1 | 0 | false | 35,279,661 | 0 | 0 | 1 | 1 | I created a scrapy project form the command line and added two spiders, myspider1 and myspider2. Whenever I run "scrapy crawl myspider1" or ""scrapy crawl myspider2" it starts "myspider1".
When I run "scrapy list" it also starts myspider1
I am running this under a vertualenv in python but I can't understand why it does... |
Google App Engine - Is it necessary to call self.response in handler? | 35,283,754 | 8 | 3 | 311 | 0 | python,google-app-engine | When your handler ends, the response goes to the client -- if you've never written anything to the response, then it will be an empty response (should come with an HTTP 204 status, but browsers are notoriously resigned to broken servers like the one you're apparently planning to create:-).
Nothing about this will cause... | 0 | 1 | 0 | 0 | 2016-02-09T02:29:00.000 | 1 | 1.2 | true | 35,282,924 | 0 | 0 | 1 | 1 | I'm developing with GAE Python. If I have a URL that routes to a handler, is it necessary to actually call self.response.out.write or self.render(if I'm using a template)?
I'm thinking if I don't specify a response.out call, then the instance GAE creates to handle that request will stay alive so to speak indefinitely? |
Django model with hundreds of fields | 35,295,319 | 0 | 3 | 390 | 0 | python,django | You could group them into a few separate models, linked by OneToOneFields to the main model. That would "namespace" your data, and namespaces are "one honking great idea". | 0 | 0 | 0 | 0 | 2016-02-09T08:55:00.000 | 3 | 0 | false | 35,287,620 | 0 | 0 | 1 | 1 | I have a model with hundreds of properties. The properties can be of different types (integer, strings, uploaded files, ...). I would like to implement this complex model step by step, starting with the most important properties. I can think of two options:
Define the properties as regular model fields
Define a separa... |
Deploying Django update to live server | 35,299,971 | 0 | 1 | 671 | 0 | python,django,deployment,django-south | It would be much safer to use a backup of the live data to test it locally
Changes should never be tested in live production.
You should try to at least have a test server that mimics the live one to push to first
is there anything else I should be aware of?
Depends what versions of apps your changing from and to. D... | 0 | 0 | 0 | 0 | 2016-02-09T18:21:00.000 | 1 | 0 | false | 35,299,374 | 0 | 0 | 1 | 1 | Django is not my main framework, I was hired on contract to update an already existing (live) Django application. Now is time for deployment of my updates to the live server, so I thought I would ask to make sure my process will not cause any problems.
The Django version that was being used was extremely old (2012) and... |
Returning Items in scrapy's start_requests() | 35,317,246 | 1 | 5 | 1,541 | 0 | python,scrapy | I think using a spider middleware and overwriting the start_requests() would be a good start.
In your middleware, you should loop over all urls in start_urls, and could use conditional statements to deal with different types of urls.
For your special URLs which do not require a request, you can
directly call your pi... | 0 | 0 | 1 | 0 | 2016-02-09T18:57:00.000 | 2 | 1.2 | true | 35,300,052 | 0 | 0 | 1 | 1 | I am writing a scrapy spider that takes as input many urls and classifies them into categories (returned as items). These URLs are fed to the spider via my crawler's start_requests() method.
Some URLs can be classified without downloading them, so I would like to yield directly an Item for them in start_requests(), whi... |
Django template filters not working at all | 35,306,452 | 0 | 0 | 313 | 0 | django,postgresql,python-3.x,django-templates,django-template-filters | Turns out this had nothing to do with Django itself, which is not surprising.
The data migration which happened between the last and current version broke the newlines in the raw data. Therefore the linebreaksbr was working, but didn't find any linebreaks. | 0 | 0 | 0 | 0 | 2016-02-10T02:06:00.000 | 1 | 0 | false | 35,305,671 | 0 | 0 | 1 | 1 | Currently I have a working Django 1.9 application using Python 3.5 in development. The database is Postgres 9.4.2.0.
I have a TEXT type field in the database which contains raw input gathered from users, which is then rendered back for other users to read.
The raw text contains newlines and whatnot which look like:
c... |
Adding custom fields to a django model (without changes in source code) | 35,466,901 | 0 | 8 | 1,657 | 0 | python,django,database-schema | I know it sounds like an awful hack, but maybe you can build an interface that creates text files?
One file would be models.py, with model definitions, and excluding this model from migrations with managed = False
Another file is the SQL with DROP and CREATE table if the customer wants a new table, or just ALTER table... | 0 | 0 | 0 | 0 | 2016-02-10T08:53:00.000 | 6 | 0 | false | 35,310,552 | 0 | 0 | 1 | 2 | A customer wants to add custom fields to a django model we provide.
He wants to do this on his own, without programming.
These things should be addable:
boolean (yes/no) fields. Optional "unset"
single choice fields
multiple choice fields
single line text fields
textarea fields
date
Example:
The customer wants to a... |
Adding custom fields to a django model (without changes in source code) | 35,414,612 | 2 | 8 | 1,657 | 0 | python,django,database-schema | Well, when I had such problem, I used to create a custom field model, with a name field and a type field, usually a choice field with choices for the possible field types. You can also add a is_active field to filter the active and inactive CustomFields.
Than, when I create the for, I search this objects to know which ... | 0 | 0 | 0 | 0 | 2016-02-10T08:53:00.000 | 6 | 0.066568 | false | 35,310,552 | 0 | 0 | 1 | 2 | A customer wants to add custom fields to a django model we provide.
He wants to do this on his own, without programming.
These things should be addable:
boolean (yes/no) fields. Optional "unset"
single choice fields
multiple choice fields
single line text fields
textarea fields
date
Example:
The customer wants to a... |
Working of the distil networks bot detection | 61,044,312 | 0 | 2 | 4,932 | 0 | python,security,web-scraping | I personally drown it in proxies. 1 proxy for 4 requests before blocked, then I change proxy. I've several tens of thousands of free proxies, so it's not a big problem. But it's not very fast, so I set concurrency to 1k or about that. | 0 | 0 | 1 | 0 | 2016-02-10T11:40:00.000 | 2 | 0 | false | 35,314,206 | 0 | 0 | 1 | 2 | I am trying to scrape a website using Scrapy framework in python. But i am getting the captchas. The server implements the bot detection using Distil netwrok bot detection. Is there anyway i can work around with it? |
Working of the distil networks bot detection | 35,330,104 | -8 | 2 | 4,932 | 0 | python,security,web-scraping | You can get over it by using tools like Selenium. It is a web testing framework that automatically loads the web browser to mimic a normal user. Once a page loads, you can scrape the content with tools such as Scrapy or Bs4. Continue loading the next page, then scrape. It's slower than normal scrapers but it does the j... | 0 | 0 | 1 | 0 | 2016-02-10T11:40:00.000 | 2 | -1 | false | 35,314,206 | 0 | 0 | 1 | 2 | I am trying to scrape a website using Scrapy framework in python. But i am getting the captchas. The server implements the bot detection using Distil netwrok bot detection. Is there anyway i can work around with it? |
Storing unstructured data with ramses to be searched with Ramses-API? | 35,405,127 | 0 | 1 | 95 | 0 | python,json,elasticsearch | This is Chrisses answer, copied from gitter.im:
You can use the dict field type for "unstructured data", as it takes arbitrary json. If the db engine is postgres, it uses jsonfield under the hood, and if the db engine is mongo, it's converted to a bson document as usual. Either way it should index automatically as expe... | 0 | 1 | 0 | 0 | 2016-02-10T15:13:00.000 | 2 | 1.2 | true | 35,318,866 | 0 | 0 | 1 | 1 | I would like to give my users the possibility to store unstructured data in JSON-Format, alongside the structured data, via an API generated with Ramses.
Since the data is made available via Elasticsearch, I try to achieve that this data is indexed and searchable, too.
I can't find any mentioning in the docs or searchi... |
(psycopg2.OperationalError) SSL SYSCALL error: Software caused connection abort | 44,923,869 | 1 | 4 | 3,963 | 1 | python,apache,flask,amazon-redshift | I solved this error by turning DEBUG=False in my config file [and/or in the run.py]. Hope it helps someone. | 0 | 0 | 0 | 0 | 2016-02-10T18:00:00.000 | 1 | 0.197375 | false | 35,322,629 | 0 | 0 | 1 | 1 | I am using apache with mod_wsgi in windows platform to deploy my flask application. I am using sqlalchemy to connect redshift database with connection pool(size 10).
After few days suddenly I am getting follwoing error.
(psycopg2.OperationalError) SSL SYSCALL error: Software caused connection abort
Can anybody sugges... |
How does Django know the host name for a FileField? | 35,324,781 | 1 | 1 | 102 | 0 | python,django | I think by default django uses HOST = '' that equals 127.0.0.1. You can change it in settings.py however I do not know how to use two different hosts. | 0 | 0 | 0 | 0 | 2016-02-10T18:39:00.000 | 1 | 1.2 | true | 35,323,318 | 0 | 0 | 1 | 1 | How does Django know the host name for a FileField that points to my MEDIA_ROOT location? I need to replace the current host name by another one. How do I do it? |
How to locate a virtualenv install | 35,326,564 | 2 | 2 | 5,340 | 0 | python,django | Create your own virtualenv
If all fails, just recreate the virtualenv from the requirements.txt and go from there
Find out how the old app was being launched
If you insist on finding the old one, IMO the most direct way is to find how is the production Django app being ran. Look for bash scripts that start it, some sup... | 0 | 0 | 0 | 0 | 2016-02-10T21:39:00.000 | 2 | 0.197375 | false | 35,326,476 | 1 | 0 | 1 | 2 | Deploying to a live server for an existing Django application. It's a very old site that has not been updated in 3+ years.
I was hired on contract to bring it up to date, which included upgrading the Django version to be current. This broke many things on the site that had to be repaired.
I did a test deployment and i... |
How to locate a virtualenv install | 35,345,062 | 0 | 2 | 5,340 | 0 | python,django | Why not start checking what processes are actually running, and with what commandline, using ps auxf or something of the sort. Then you know if its nginx+uwsgi or django-devserver or what, and maybe even see the virtualenv path, if it's being launched very manually. Then, look at the config file of the server you find.... | 0 | 0 | 0 | 0 | 2016-02-10T21:39:00.000 | 2 | 0 | false | 35,326,476 | 1 | 0 | 1 | 2 | Deploying to a live server for an existing Django application. It's a very old site that has not been updated in 3+ years.
I was hired on contract to bring it up to date, which included upgrading the Django version to be current. This broke many things on the site that had to be repaired.
I did a test deployment and i... |
Migrations error in Django after moving to new server | 35,343,687 | 0 | 0 | 772 | 1 | python,django,postgresql,django-migrations | Try running migrate --fake-initial since you're getting the "relation already exists" error. Failing that, I would manually back up each one of my migration folders, remove them from the server, then re-generate migration files for each app and run them all again from scratch (i.e., the initial makemigrations). | 0 | 0 | 0 | 0 | 2016-02-11T10:39:00.000 | 1 | 1.2 | true | 35,336,992 | 0 | 0 | 1 | 1 | I'm developing a Django 1.8 application locally and having reached a certain point a few days ago, I uploaded the app to a staging server, ran migrations, imported the sql dump, etc. and all was fine.
I've since resumed local development which included the creation of a new model, and changing some columns on an existi... |
Can I put my views.py file in the project folder of django? | 35,339,613 | 4 | 1 | 725 | 0 | python,django | This will work fine. Views can be wherever you want.
You can add the package that is your site (the one that has settings.py in it) to INSTALLED_APPS, and then a models.py in it, management commands, et cetera will also work fine.
Apps are handy when things become big and you want to split them into smaller parts. | 0 | 0 | 0 | 0 | 2016-02-11T12:33:00.000 | 1 | 1.2 | true | 35,339,460 | 0 | 0 | 1 | 1 | I am developing a project using django python server. I have created my project on django and put all my files including views.py in the project folder and I am using it without creating any app and its working fine.
Is this the right way of doing it (or) I need to create an app instead and put all my files in the pro... |
Combining Python and Javascript in a chrome plugin | 35,349,167 | 0 | 6 | 7,214 | 0 | javascript,python,google-chrome-extension | The only way to get the output of a Python script inside a content script built with Javascript is to call the file with XMLHttpRequest. As you noted, you will have to use an HTTPS connection if the page is served over HTTPS. A workaround for this is to make a call to your background script, which can then fetch the da... | 0 | 0 | 1 | 0 | 2016-02-11T17:46:00.000 | 2 | 0 | false | 35,346,456 | 0 | 0 | 1 | 1 | I'm writing a chrome extension that injects a content script into every page the user goes to. What i want to do is to get the output of a python function for some use in the content script (can't write it in javascript, since it requires raw sockets to connect to my remote SSL server).
I've read that one might use CGI... |
What is the best way to store list of links to cloud files in django model | 35,364,106 | 0 | 0 | 516 | 0 | python,django,django-models | So you have one model in which you want to save a list of strings (links). The easiest way to do that is by creating a separate model with a textfield and a one-to-many relation. | 0 | 0 | 0 | 0 | 2016-02-12T13:35:00.000 | 3 | 0 | false | 35,363,982 | 0 | 0 | 1 | 1 | I am currently working on a project which involves a django model which should have a field containing links to images on AWS S3.
The field should be a list of strings but django has no default field for this.
I have searched online and a way to solve this is by creating another model called imagesModel and link them b... |
Asynchronous unblocked Execution/triggering of python script through javascript | 35,366,240 | 0 | 0 | 68 | 0 | javascript,python,ajax,cgi | From the question I read that you have already managed to run a Python script in a web server via CGI and you already know how to do an HTTP (ajax) request from your JavaScript to that web service.
When you now close the page in your browser (or an excavator cuts your line), the backend python script is not terminated... | 0 | 0 | 0 | 1 | 2016-02-12T13:40:00.000 | 1 | 0 | false | 35,364,084 | 0 | 0 | 1 | 1 | I am currently working on an application ROFFLE, I may not be very good in terming correctly, What I am able to do right now?
User goes on a website, he clicks on a button and an ajax request is done to python file (test.py) but when he exits, the request is aborted and the processing done till yet has gone waste
What... |
How can I add to $PATH with tox? | 35,371,901 | 2 | 3 | 1,975 | 0 | python,django,testing,protractor,tox | I think it should work if you modify your path in the manage.py file to include django-protractor directory, because the Django management command line uses manage.py. | 0 | 0 | 0 | 1 | 2016-02-12T20:32:00.000 | 2 | 1.2 | true | 35,371,697 | 0 | 0 | 1 | 1 | I'm using tox to run protractor tests which will test an application which uses django+angularjs, there is a glue library (django-protractor) which makes this easier, except that it makes the call to protractor inside a django management command, and relies on $PATH to show it where protractor is.
So if I set the $PAT... |
How to deal with nested forms?(ERROR: mechanize._form.ParseError: nested FORMs) | 35,401,852 | 0 | 0 | 336 | 0 | python,mechanize | br.select_form(predicate=lambda f: f.attrs.get('id', None) == 'email-form')
This may help you in your function for selecting the form.. | 0 | 0 | 0 | 0 | 2016-02-14T06:01:00.000 | 2 | 0 | false | 35,388,878 | 1 | 0 | 1 | 1 | I'm trying to submit a form in a website and when I run the code, it gives me the error:
mechanize._form.ParseError: nested FORMs
So I checked and in the website, there are 2 forms that are inside each other.
the form that I need, which is the first one, is closed properly.
Is there anyway to deal with that? |
Run Alembic migrations on Google App Engine | 35,395,267 | 1 | 8 | 1,816 | 1 | python,google-app-engine,flask,google-cloud-sql,alembic | You can whitelist the ip of your local machine for the Google Cloud SQL instance, then you run the script on your local machine. | 0 | 1 | 0 | 0 | 2016-02-14T11:17:00.000 | 3 | 0.066568 | false | 35,391,120 | 0 | 0 | 1 | 1 | I have a Flask app that uses SQLAlchemy (Flask-SQLAlchemy) and Alembic (Flask-Migrate). The app runs on Google App Engine. I want to use Google Cloud SQL.
On my machine, I run python manage.py db upgrade to run my migrations against my local database. Since GAE does not allow arbitrary shell commands to be run, how d... |
Openerp information messages | 35,422,853 | 0 | 2 | 34 | 0 | python,openerp,openerp-7 | You can create a wizard with cancel and proceed button within | 0 | 0 | 0 | 0 | 2016-02-14T15:57:00.000 | 2 | 0 | false | 35,393,776 | 0 | 0 | 1 | 1 | Is it possible to create information message with options like proceed or cancel in OpenERP ? If it is possible how to create one ? |
How use changefeed with 2 tables? | 35,417,780 | 0 | 0 | 35 | 0 | python,rethinkdb | The easiest thing to do would be to denormalize your data so that your changefeed only has to look at one table. | 0 | 0 | 0 | 0 | 2016-02-15T16:47:00.000 | 1 | 0 | false | 35,414,707 | 0 | 0 | 1 | 1 | I use rethinkdb changefeed and I need to catch event from one table with condition from another: first table contains some information, second table contains info about user and I need catch change in first table by the specific user.
I tryed join tables and use changefeed with it, but it not works good.
Are there way... |
How can I model this behavior in Django? | 35,422,055 | 1 | 1 | 105 | 0 | python,django,forms,model,message | I assume that you will have some view which will render page on which user of your site will be able to read the unread notifications. So I think you can simply add to notifications model bool field unread. This field is set up when there is new notification to true. After user render page with unread notifications thi... | 0 | 0 | 0 | 0 | 2016-02-16T01:14:00.000 | 2 | 0.099668 | false | 35,422,002 | 0 | 0 | 1 | 1 | I want to develop a notification system with Django. So I have an button (and a count of unread messages), that show all messages to the user, so the counter returns to zero again. How can detect my database, that the user already has read the messages and reset the counter? I dont think that I can emulate this with fo... |
Google App Engine Console shows more entities than I created | 35,578,109 | 1 | 0 | 70 | 0 | python,google-app-engine,google-cloud-datastore,google-console-developer | If you check the little question-mark near the statistics summary it says the following:
Statistics are generated every 24-48 hours. In addition to the kinds used for your entities, statistics also include system kinds, such as those related to metadata. System kinds are not visible in your kinds menu. Note that stati... | 0 | 1 | 0 | 0 | 2016-02-16T02:14:00.000 | 1 | 0.197375 | false | 35,422,495 | 0 | 0 | 1 | 1 | I recently deployed my app on GAE.
In my Datastore page of Google Cloud Console, in the Dashboard Summary, it shows that I have 75 entities. However, when I click on the Entities tab, it shows I have 2 entities of one kind and 3 entities of another kind. I remember creating these entities. I'm just curious where the 75... |
When Mongoengine rebuild indexes? | 35,648,604 | 1 | 3 | 349 | 1 | python,mongodb,mongoengine | Mongoengine do not rebuild index automaticly. Mongoengine track changes in models (btw dont work if you add sparse to your filed(if field dont have unique options)) and then fire the ensureIndex in mongoDB. But when its fire - make sure you delete oldest index version manualy(Mongoengine doesn't) in mongoDB.
The probl... | 0 | 0 | 0 | 0 | 2016-02-16T16:11:00.000 | 1 | 1.2 | true | 35,437,458 | 0 | 0 | 1 | 1 | When Mongoengine rebuild(update) a information about indexes? I mean, if a added or change some field (added uniques or sparse option to filed) or added some meta info in model declaration.
So question is:
When mongoengine update it?
How do they track changes? |
Django import-export leading zeros for numerical values in excel | 35,437,885 | 0 | 1 | 281 | 0 | python,django,excel,django-import-export | An easy fix would be adding an apostrophe (') at the beginning of each number when doing using import-export. This way Excel will recognize those numbers as a text. | 0 | 0 | 0 | 0 | 2016-02-16T16:19:00.000 | 2 | 0 | false | 35,437,656 | 0 | 0 | 1 | 1 | I am faced with the following problem: when I generate .csv files in python using django-import-export even though the field is a string, when I open it in Excel the leading zeros are omitted. E.g. 000123 > 123.
This is a problem, because if I'd like to display a zipcode I need the zeros the way they are. I can cover i... |
Create regular backups from OS X to the cloud | 35,442,348 | 4 | 5 | 35 | 0 | python,django,macos | This is what version control is for. Sign up for an account at Github, Bitbucket, or Gitlab, and push your code there. | 0 | 1 | 0 | 0 | 2016-02-16T18:43:00.000 | 1 | 1.2 | true | 35,440,612 | 0 | 0 | 1 | 1 | I'm developing a Django project on my MacBook Pro. Constantly paranoid that if my house burns down, someone stoling my MB, hard drive failure or another things that are not likely, but catastrophic if it occurs.
How can I create or get automatic backup every 1 hour from my OS X directory where the Django project is to ... |
update existing cache data with newer items in django | 35,447,745 | 3 | 1 | 1,927 | 0 | python,django,caching,django-models,django-views | You ask about "caching" which is a really broad topic, and the answer is always a mix of opinion, style and the specific app requirements. Here are a few points to consider.
If the data is per user, you can cache it per user:
from django.core.cache import cache
cache.set(request.user.id,"foo")
cache.get(request.user.i... | 0 | 0 | 0 | 0 | 2016-02-17T03:01:00.000 | 1 | 1.2 | true | 35,447,087 | 0 | 0 | 1 | 1 | I want to use caching in Django and I am stuck up with how to go about it. I have data in some specific models which are write intensive. records will get added continuously to the model. Each user has some specific data in the model similar to orders table.
Since my model is write intensive I am not sure how effecti... |
Scrapy: Create Project returning error | 35,451,490 | 1 | 4 | 4,043 | 0 | python,web-scraping,scrapy | Looks like you are trying the command scrapy startproject stack inside python interactive shell.
Run the same command directly on bash shell, and not inside python shell.
And you don't need import scrapy command to create a scrapy project. | 0 | 0 | 0 | 0 | 2016-02-17T08:23:00.000 | 1 | 1.2 | true | 35,451,340 | 0 | 0 | 1 | 1 | I'm learning scrapy to create a crawler that could crawl website and get back the results, however on creating a new project, it is returning an error.
I tried creating a folder manually, but again it returned an error.
Any idea how to resolve this.
SyntaxError: invalid syntax
import scrapy
scrapy startproject stack |
Lock the system | 35,453,880 | 1 | 0 | 52 | 0 | python,django | Add some boolean field (answered, is_answered.. etc) and check on every "Response" click if it answered.
Hope it will help. | 0 | 0 | 0 | 0 | 2016-02-17T10:02:00.000 | 2 | 0.099668 | false | 35,453,451 | 0 | 0 | 1 | 1 | I am writing a mini-CRM system that two users can login at the same time and they can answer received messages. However, the problem is that they might response the same message because messages can only disappear when they click "Response" button. Is there any suggestion to me to lock the system? |
Wing IDE not stopping at break point for Google App Engine | 35,457,609 | 2 | 2 | 544 | 0 | python,google-app-engine,debugging,breakpoints | As often happens with these things, writing this question gave me a couple of ideas to try. I was using the Personal edition ... so I downloaded the professional edition ... and it all worked fine.
Looks like I'm paying $95 instead of $45 when the 30 day trial runs out. | 0 | 1 | 0 | 0 | 2016-02-17T12:52:00.000 | 2 | 0.197375 | false | 35,457,300 | 0 | 0 | 1 | 2 | I'm new to Python, Wing IDE and Google cloud apps.
I've been trying to get Wing IDE to stop at a breakpoint on the local (Windows 7) Google App Engine. I'm using the canned guestbook demo app and it launches fine and responds as expected in the web browser.
However breakpoints are not working. I'm not sure if this is i... |
Wing IDE not stopping at break point for Google App Engine | 42,961,127 | 5 | 2 | 544 | 0 | python,google-app-engine,debugging,breakpoints | I have copied the wingdbstub.py file (from debugger packages of Wing ide) to the folder I am currently running my project on and used 'import wingdbstub' & initiated the debug process. All went well, I can now debug modules. | 0 | 1 | 0 | 0 | 2016-02-17T12:52:00.000 | 2 | 0.462117 | false | 35,457,300 | 0 | 0 | 1 | 2 | I'm new to Python, Wing IDE and Google cloud apps.
I've been trying to get Wing IDE to stop at a breakpoint on the local (Windows 7) Google App Engine. I'm using the canned guestbook demo app and it launches fine and responds as expected in the web browser.
However breakpoints are not working. I'm not sure if this is i... |
Python requests vs java webservices | 35,458,539 | 0 | 0 | 254 | 0 | java,python,web-services,python-requests,legacy | Maybe you could add a man-in-the-middle. A socket server who gets the unix strings, parse them into a sys-2 type of message and send it to sys-2. That could be an option to not re-write all calls between the two systems. | 0 | 1 | 0 | 0 | 2016-02-17T13:03:00.000 | 2 | 0 | false | 35,457,531 | 0 | 0 | 1 | 2 | I have a legacy web application sys-1 written in cgi that currently uses a TCP socket connection to communicated with another system sys-2. Sys-1 sends out the data in the form a unix string. Now sys-2 is upgrading to java web service which in turn requires us to upgrade. Is there any way to upgrade involving minimal c... |
Python requests vs java webservices | 35,458,442 | 0 | 0 | 254 | 0 | java,python,web-services,python-requests,legacy | Is there any way to upgrade involving minimal changes to the existing legacy code.
The solution mentioned, adding a conversion layer outside of the application, would have the least impact on the existing code base (in that it does not change the existing code base).
Can anyone advise if this method works
Would writ... | 0 | 1 | 0 | 0 | 2016-02-17T13:03:00.000 | 2 | 1.2 | true | 35,457,531 | 0 | 0 | 1 | 2 | I have a legacy web application sys-1 written in cgi that currently uses a TCP socket connection to communicated with another system sys-2. Sys-1 sends out the data in the form a unix string. Now sys-2 is upgrading to java web service which in turn requires us to upgrade. Is there any way to upgrade involving minimal c... |
What options are there for verifying that mturk is requesting my ExternalQuestion and not a 3rd party? | 35,503,013 | 1 | 0 | 59 | 0 | python,django,authorization,mechanicalturk | Every request from AWS will include additional URL parameters: workerId, assignmentId, hitId. That's probably the easiest way to identify a request coming from MTurk. There may be headers, as well, but they're not documented anywhere. | 0 | 0 | 1 | 0 | 2016-02-19T01:44:00.000 | 1 | 1.2 | true | 35,495,874 | 0 | 0 | 1 | 1 | I have a django application that I want to host a form on to use as the template for an ExternalHit on Amazon's Mechanical Turk. I've been trying to figure out ways that I can make it so only mturk is authorized to view this document.
One idea I've been considering is looking at the request headers and confirming that ... |
How to setup FastCGI setting of IIS with GDAL libs | 35,591,876 | 0 | 0 | 134 | 0 | python,django,iis,fastcgi,gdal | Solved it by restart the machine | 0 | 0 | 0 | 1 | 2016-02-19T04:36:00.000 | 1 | 1.2 | true | 35,497,392 | 0 | 0 | 1 | 1 | I set up a django website via IIS manager, which is working fine, then I add a function by using GDAL libs and the function is working fine.
And also it is fine if I run this website by using CMD with this command
python path\manage.py runserver 8000
But it cannot run via IIS
I got error is DLL load failed: The specifi... |
AWS Lambda parameter passing | 42,859,631 | 0 | 0 | 1,250 | 0 | python,amazon-web-services,aws-lambda | You also have to include the query string parameter in the section Resources/Method Request. | 0 | 0 | 0 | 1 | 2016-02-19T12:12:00.000 | 2 | 0 | false | 35,505,089 | 0 | 0 | 1 | 1 | I am creating an api with AWS API Gateway with Lambda functions. I want to be able to make an API call with the following criteria:
In the method request of the API i have specified the Query String: itemid
I want to be able to use this itemid value within my lambda function
I am using Python in Lambda
I have tried p... |
Django: Can template tags prevent content to be rendered to the clients? | 35,516,808 | 1 | 0 | 59 | 0 | python,django,performance | Yes, any content within the {% if condition %} and {% endif %} tags will not be sent the client if condition evaluates to False. It is not hidden via CSS, the content will simply not exist in the response.
It will also reduce the size of your HTTP response. | 0 | 0 | 0 | 0 | 2016-02-19T23:07:00.000 | 1 | 0.197375 | false | 35,516,720 | 0 | 0 | 1 | 1 | {% if foo == 1 %}
<-- blah blah blah -->>
{% endif %}
If the if block above evaluates the false, would the content inside the if block still be rendered to the client but hidden instead?
If not, is this method an acceptable way to reduce page load? |
Django deployed project not running subprocess shell command | 35,524,148 | 4 | 1 | 309 | 0 | python,django,shell,subprocess,gunicorn | 1) User who runs gunicorn has no permissions to run .sh files
2) Your .sh file has no rights to be runned
3) Try to user full path to the file
Also, which error do you get when trying to run it on the production? | 0 | 1 | 0 | 0 | 2016-02-20T13:37:00.000 | 1 | 1.2 | true | 35,524,022 | 0 | 0 | 1 | 1 | I have a django 1.9 project deployed using gunicorn with a view contains a line
subprocess.call(["xvfb-run ./stored/all_crawlers.sh "+outputfile+" " + url], shell=True, cwd= path_to_sh_file)
which runs fine with ./manage.py runserver
but fails on deployment and (deployed with gunicorn and wsgi).
Any Suggestion how ... |
Include django rest pandas dataframe Index field in json response | 38,318,621 | 0 | 0 | 363 | 0 | python,django,django-rest-framework | One simple way would be to just reset the index in transform_dataframe method.
df = df.reset_index()
This would just add a new index and set your old index as a column, included in the output. | 0 | 0 | 0 | 0 | 2016-02-21T08:39:00.000 | 1 | 0 | false | 35,534,039 | 0 | 1 | 1 | 1 | Backgroud
I am using django-rest-pandas for serving json & xls.
Observation
When I hit url with format=xls, I get complete data in the downloaded file. But for format=josn, the index field of dataframe is not part of the records.
Question
How can I make django-rest-pandas to include dataframe's index field in json re... |
Django: removing non-used files | 35,534,947 | 5 | 3 | 1,427 | 0 | python,django,refactoring | This is not neccessery since django will pick only the updated files, and the whole idea of collectstatic is that you don't have to manually manage the static files.
However, if the old files do take a lot of space, once in while you can delete all the files and directories in the static directory, and then run collect... | 0 | 0 | 0 | 0 | 2016-02-21T08:56:00.000 | 1 | 1.2 | true | 35,534,170 | 0 | 0 | 1 | 1 | Is the any automated way to remove (or at least mark) unused non-used (non-referenced) files located in /static/ folder and its sub-folders in Django project? |
if __name__ == "__main__" condition with flask/Elastic Beanstalk | 35,546,210 | 0 | 1 | 1,304 | 0 | python,amazon-web-services,flask,amazon-elastic-beanstalk | My best guess is that adding if __name__ == '__main__' didn't fix anything, but it coincidentally happened to work that time. | 0 | 0 | 0 | 0 | 2016-02-22T04:27:00.000 | 1 | 1.2 | true | 35,545,822 | 0 | 0 | 1 | 1 | I was setting up a simple flask app on AWS with Elastic Beanstalk, but had a bug that would result in a timeout error when visiting the page
ERROR: The operation timed out. The state of the environment is
unknown.
when running 'eb create'). Ultimately I fixed it by inserting the standard if __name__ == '__main__':... |
Rebuilding Django development server database | 35,551,670 | 1 | 1 | 3,441 | 0 | python,mysql,django | You should delete the migrations folder inside your app folder. You should also delete the database file, if there is one (for SQLite there is a file called db.sqlite3 in the root project folder, but I'm not sure how this works for MySQL). Then run makemigrations and migrate. | 0 | 0 | 0 | 0 | 2016-02-22T08:50:00.000 | 2 | 0.099668 | false | 35,549,309 | 0 | 0 | 1 | 1 | I'm trying to reset my django database so I've run manage.py sqlflush and run that output in MySQL.
I've then run manage.py flush. I think this should clear everything.
I've then run manage.py makemigrations which seemed to identify all tables that would need building but when I run manage.py migrate it says nothing ... |
PhantomJS was placed in path and can execute in terminal, but PATH error in Python | 46,802,328 | 1 | 4 | 8,984 | 0 | python,selenium,phantomjs | If you were able to execute in Terminal, just restart PyCharm and it will synchronize the environment variables from the system. (You can check in "RUN" => "Edit Configurations") | 0 | 0 | 1 | 0 | 2016-02-22T23:07:00.000 | 4 | 0.049958 | false | 35,565,733 | 1 | 0 | 1 | 1 | note: PhantomJS runs in PyCharm environment, but not IDLE
I have successfully used PhantomJS in Python in the past, but I do not know what to do to revert to that set up.
I am receiving this error in Python (2.7.11): selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
I... |
How to use classic Django app with Django REST framework? | 35,583,466 | 2 | 0 | 422 | 0 | python,django,rest,django-rest-framework | "Normal" Django views (usually) return HTML pages.
Django-Rest-Framework views (usually) return JSON.
I am assuming you are looking for something more like a Single page application.
In this case you will have a main view that will be the bulk of the HTML page. This will be served from "standard" Django view returni... | 0 | 0 | 0 | 0 | 2016-02-23T10:26:00.000 | 1 | 0.379949 | false | 35,574,857 | 0 | 0 | 1 | 1 | I want to use Django REST framework for my new project but I am not sure if I can do it efficiently. I would like to be able to integrate easily classical Django app in my API. However I don't know how I can proceed to make them respect the REST framework philosophy. Will I have to rewrite all the views or is there a m... |
django "python manage.py validate" error : unknown command 'validate' | 35,579,891 | 1 | 10 | 7,322 | 0 | django,python-3.4 | With python manage.py these commands are listed:
Available subcommands:
[auth]
changepassword
createsuperuser
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
sendtestemail
shell
showmigrations
sqlflush
sqlmigrate
sqlsequencerese... | 0 | 0 | 0 | 0 | 2016-02-23T12:10:00.000 | 3 | 0.066568 | false | 35,577,248 | 0 | 0 | 1 | 2 | With running this command:
python manage.py validate
I faced with this error:
Unknown command: 'validate'
What should I do now?
For more explanations:
Linux
Virtualenv
Python 3.4.3+
Django (1, 9, 2, 'final', 0) |
django "python manage.py validate" error : unknown command 'validate' | 35,597,374 | 0 | 10 | 7,322 | 0 | django,python-3.4 | With this command:
pip install Django==1.8.2
the problem will be solved.
Django==1.9.2 does not support some commands. | 0 | 0 | 0 | 0 | 2016-02-23T12:10:00.000 | 3 | 0 | false | 35,577,248 | 0 | 0 | 1 | 2 | With running this command:
python manage.py validate
I faced with this error:
Unknown command: 'validate'
What should I do now?
For more explanations:
Linux
Virtualenv
Python 3.4.3+
Django (1, 9, 2, 'final', 0) |
How to include template (with CSS) onto a template which is being rendered? | 35,588,407 | 0 | 0 | 116 | 0 | python,html,css,jinja2 | You can use flask, and put your css stylesheet in a folder named "static", at the root of your project. Call this file "style.css". | 0 | 0 | 0 | 0 | 2016-02-23T16:48:00.000 | 1 | 0 | false | 35,583,348 | 0 | 0 | 1 | 1 | I am relatively new to Jinja and templating and have been struggling to get this sorted for some time now..
Here's my layout of folders:
templates
base
content
form
styles
newstyle
I have a base template with blockhead/block sidebar/block content/block form layout. I extend it to my content template which has lots ... |
Custom user dashboard in django | 35,698,893 | 1 | 1 | 1,209 | 0 | python,django,dashboard | I wasn't able to elaborate my question coz am a django newbie, but after a week of trying a lot of different things I found a way out. For the dealers and other non staff users I created a dashboard and also overiding the registration to suit my project.
Its now working fine. | 0 | 0 | 0 | 0 | 2016-02-23T21:09:00.000 | 2 | 1.2 | true | 35,588,202 | 0 | 0 | 1 | 2 | I have a system that has two types of users with different privileges, the first user is the admin who can access all objects from the database, the second one is a dealer who can only view information pertaining to them alone.(There are many dealers)
This is how the system iworks: the admin creates a coupon code and i... |
Custom user dashboard in django | 35,592,084 | 2 | 1 | 1,209 | 0 | python,django,dashboard | This sounds like a situation where you want the functionality to be loosely coupled to prevent headaches down the road, so I'd go with option 3. Leave the admin for the admins and create a new dealer app for the dealers to go to, with a regular view/model/template that they'll be required to login to see. | 0 | 0 | 0 | 0 | 2016-02-23T21:09:00.000 | 2 | 0.197375 | false | 35,588,202 | 0 | 0 | 1 | 2 | I have a system that has two types of users with different privileges, the first user is the admin who can access all objects from the database, the second one is a dealer who can only view information pertaining to them alone.(There are many dealers)
This is how the system iworks: the admin creates a coupon code and i... |
Which approach to use for customizing django-registration-redux | 35,593,731 | 0 | 0 | 102 | 0 | python,django | First of all, if you want to override almost every part of redux, wont it be better to use built-in django authentication and to extend it as you wish?
Yes, you are on the right way. You need to override those things you do not like by coping them to your project and then by changing the copy. Though it's will be a cle... | 0 | 0 | 0 | 0 | 2016-02-24T01:49:00.000 | 1 | 0 | false | 35,591,797 | 0 | 0 | 1 | 1 | The first thing I did was of course customizing forms, views and templates in site-packages. And then I learned that everything will be reset to default after upgrading the package.
So now I decided to create a new application "accounts" and make customizations there.
My question is which approach is better (haven't tr... |
Django Allauth mails stop working when I change my smtp provider (mandrill) | 35,596,437 | 0 | 0 | 86 | 0 | python,django,email,mandrill,django-allauth | Turns out I needed to add DEFAULT_FROM_EMAIL to my settings.py file. I don't understand why it works with a gmail address and not a custom one, but this fixed it. | 0 | 0 | 0 | 1 | 2016-02-24T07:41:00.000 | 1 | 1.2 | true | 35,596,059 | 0 | 0 | 1 | 1 | I started my app with a gmail account, and have recently upgraded to Mandrill. I am not using the API, just changed my smtp settings through env variables.
When I add the new mandrill smtp provider, my in-app mails work perfectly, but allauth's mails do not work at all. (I can see they are not rejected or bounced throu... |
deployment of scrapy selenium project | 35,968,793 | 0 | 0 | 146 | 0 | python,selenium,deployment,scrapy | As for my problem with phantomjs it was solved by reinstalling it and increasing the droplet memory .. and for the other message with the other browsers I used "xvfb-run -a" it was a temporary solution but it worked ... | 0 | 0 | 1 | 0 | 2016-02-24T11:13:00.000 | 1 | 1.2 | true | 35,600,560 | 0 | 0 | 1 | 1 | I am new to scrapping.
I have a scrapy spider that uses selenium for items interaction
I tried to run it on a digitalocean droplet but it fails to runs the phantomjs driver all the time like it's kinda blocked raising exception:
BadStatusLine: ''
and any other webdrivers are unstable according to the display issue a... |
Unicode issue using flask and mssql guids with FreeTDS | 35,608,084 | 0 | 0 | 167 | 1 | python,sql-server,flask,jinja2 | Well, this feels like a hack, but since the only time I'm ever using these guid's is when i'm reading them from the database, I just did:
CAST(REC_GUID_ID as VARCHAR(36)) as REC_GUID_ID
And now they are in a format that everything seems to read just fine. | 0 | 0 | 0 | 0 | 2016-02-24T14:31:00.000 | 1 | 1.2 | true | 35,604,937 | 0 | 0 | 1 | 1 | I have a flask app that recently had to start using mssql generated guid's as primary keys (previously it was just integers). The guid's are latin-1 encoding. Also, I am not using sqlalchemy. Now, when I'm trying to display the queried mssql guid's in a flask jinja2 template, I get the following error:
UnicodeDecodeEr... |
Django, Angular, & DRF: Authentication to Django backend vs. API | 35,726,205 | 0 | 5 | 698 | 0 | python,django,django-rest-framework,django-rest-auth | To anyone that stumbles onto this question, I couldn't figure out how to make the hybrid approach work. Having Django serve pages that each contained API calls seemed OK, but I never saw any requests made to the API- I believe due to some other security issues. I'm sure it's possible, but I decided to go for the single... | 0 | 0 | 0 | 0 | 2016-02-24T16:32:00.000 | 1 | 1.2 | true | 35,607,753 | 0 | 0 | 1 | 1 | I'm building an app with a Django backend, Angular frontend, and a REST API using Django REST Framework for Angular to consume. When I was still working out backend stuff with a vanilla frontend, I used the provided Django authentication to handle user auth- but now that I'm creating a REST based app, I'm not sure how ... |
Programmatically managing Cassandra permissions | 35,617,799 | 0 | 2 | 54 | 0 | javascript,python,ruby,cassandra | Not sure you tried this approach, add tenant info with all your table keys, this way you write your class method to prepare query with tenant will append to it.
1) "ClientA:Name" ....
2) "ClientB:Name"... | 0 | 0 | 0 | 0 | 2016-02-24T19:39:00.000 | 1 | 0 | false | 35,611,473 | 0 | 0 | 1 | 1 | I'm wondering about the best way to manage multitenancy in Cassandra. I have a web app, and I want all users in the web app to have a namespaced area in Cassandra. I can do this via cqlsh (create user with password + grants), but I can't find documentation on it for the ruby, python, or javascript drivers. Any help?
ED... |
Is it possible to deploy Django with Sqlite? | 35,615,302 | -2 | 0 | 3,302 | 1 | python,django,postgresql,sqlite,heroku | sure you can deploy with sqlite ... its not really recommended but should work ok if you have low network traffic
you set your database engine to sqlite in settings.py ... just make sure you have write access to the path that you specify for your database | 0 | 0 | 0 | 0 | 2016-02-24T23:23:00.000 | 3 | -0.132549 | false | 35,615,273 | 0 | 0 | 1 | 1 | I've built a Django app that uses sqlite (the default database), but I can't find anywhere that allows deployment with sqlite. Heroku only works with postgresql, and I've spent two days trying to switch databases and can't figure it out, so I want to just deploy with sqlite. (This is just a small application.)
A few q... |
Should I generate *.pyc files when deploying? | 35,619,259 | 5 | 5 | 2,979 | 0 | python,deployment,pyc | Sure, you can go ahead and precompile to .pyc's as it won't hurt anything.
Will it affect the first or nth pageload? Assuming Flask/WSGI runs as a persistent process, not at all. By the time the first page has been requested, all of the Python modules will have already been loaded into memory (as bytecode). Thus, serve... | 0 | 0 | 0 | 1 | 2016-02-25T04:10:00.000 | 1 | 0.761594 | false | 35,618,159 | 0 | 0 | 1 | 1 | When developing a Python web app (Flask/uWSGI) and running it on my local machine, *.pyc files are generated by the interpreter. My understanding is that these compiled files can make things load faster, but not necessarily run faster.
When I deploy this same app to production, it runs under a user account that has no ... |
'pip' command doesn't execute in console2 but executes in windows command prompt | 35,623,671 | 0 | 1 | 36 | 0 | python,django | Check PATH environment variable in console2. It should contains path to the pip executable.
In Windows Command-Prompt the syntax is echo %PATH%
To get a list of all environment variables enter the command set | 0 | 0 | 0 | 0 | 2016-02-25T09:41:00.000 | 1 | 1.2 | true | 35,623,515 | 1 | 0 | 1 | 1 | I have downloaded console2 for windows. Using that I wanted to setup django framework, but console2 couldn't recognize 'pip' as a command. When I tried the same command in windows command prompt, 'pip' was recognized by windows command prompt. Why so? |
Slash in parameter Django | 35,633,712 | 0 | 1 | 979 | 0 | python,django | You will have to use a different separator character between parameters than inside parameters. After parameters have been matched, you can always replace that separator by the slash that should actually be there inside the parameters.
So, either those parameters that use a slash internally allow for some other safe ch... | 0 | 0 | 0 | 0 | 2016-02-25T16:39:00.000 | 2 | 0 | false | 35,633,187 | 0 | 0 | 1 | 1 | I'm using Django as a restful api, and i have urls like url(r'^datavore/(?P<configuration>.*)/(?P<dataset>.*)/(?P<varname>.*)/(?P<region>[a-z-A-Z\_]+)/(?P<date_range>.*)/filelist/$', views.filelist,name="filelist"),
my problem is when the dataset parameter contains '/' it modify the structur of m... |
Django virtual environment disaster | 35,637,631 | 2 | 1 | 108 | 0 | python,django,bash | I assume you're using virtualenv. If so, do you know where it put the bin directory? If so, run source bin/activate. After that, when you try runserver, it should use the correct Python instance.
More complete:
source /path/to/bin/activate
But I typically run source bin/activate from the directory that contains the ... | 0 | 1 | 0 | 0 | 2016-02-25T20:20:00.000 | 2 | 0.197375 | false | 35,637,516 | 0 | 0 | 1 | 1 | I am working on a django app on my macbook with Yosemite.
My app was in a virtual environment.
I restarted my terminal and when I cd'd to my app it was no longer in the virtual environment and now doesn't run. And all my virtual environment commands give me -bash: command not found.
I fully recognize this is a very noo... |
Fill the current time based on the selection of the country in html dropdown | 35,643,411 | 0 | 0 | 397 | 0 | javascript,php,jquery,python,html | One way to do it is to get the country name of the select tag with $( "#myselect option:selected" ).text(); or it's value with $( "#myselect" ).val(); and then use a switch statement to change the date time field. | 0 | 0 | 0 | 0 | 2016-02-26T04:01:00.000 | 2 | 0 | false | 35,643,223 | 0 | 0 | 1 | 1 | I have an HTML drop-down where country names are specified.And there is another field where a date time field is specified.
When a user selects a country i want the date-time field to be filled with current date-time of that particular country.Please let me know in what all ways this can be done and how.
Thanks in adva... |
How do I make a custom email template for django-registration-redux password reset? | 35,650,368 | 4 | 0 | 606 | 0 | python,django | Based on itzmeontv's answer:
To override original templates in registration application.
create folder templates inside your base app if it doesn't exist
create folder registration inside it. So folder looks like <yourapp>/templates/registration
Inside yourapp/templates/registration , create htmls with same name as in... | 0 | 0 | 0 | 0 | 2016-02-26T08:49:00.000 | 2 | 0.379949 | false | 35,647,221 | 0 | 0 | 1 | 1 | As the question says, I'm using django-registration-redux and I've made templates for the registration emails and pages but can't figure out how to make the template for the password reset email.
I'm using django 1.9 |
How to connect between HTML button and python(or flask) function? | 35,647,647 | 2 | 0 | 1,304 | 0 | python,html,flask | You can't trigger anything on the server without making a request to a URL.
If you don't want the page to reload, you can either redirect back to the original page after your action is finished, or you can use Ajax to make the request without changing the page; but the request itself is always to a URL. | 0 | 0 | 0 | 0 | 2016-02-26T09:06:00.000 | 1 | 1.2 | true | 35,647,516 | 0 | 0 | 1 | 1 | In flask programming, people usually use 'url_for' such as {{url_for = 'some url'}}
This way have to make URL(@app.route), template(HTML) and map each other.
But, I just want to send email when I click submit button in HTML modal.
For this, There is no page reloading. To do this, I think I have to connect between butto... |
Is it ok to rely on lots of third party packages? | 35,656,339 | 3 | 0 | 96 | 0 | python,django | Well, I think this a lot based on your opinion.
Personally I would say it's a good idea to use a lot of third party packages. It enables you to develop faster and why inventing the wheel all over again?
Advantages:
faster development
DRY, don't reinvent the wheel
higher likelihood that the tools are time-tested and h... | 0 | 0 | 0 | 0 | 2016-02-26T15:56:00.000 | 1 | 0.53705 | false | 35,656,229 | 1 | 0 | 1 | 1 | My organization uses django for our website so we have the opportunity to use pypi packages, but we don't seem to have used many in the past and developers have written there own solutions instead. I've always used lots of packages in my own project. Is there really any downside to using these packages? |
Django: Difference between using server through manage.py and other servers like gunicorn etc. Which is better? | 35,657,627 | 8 | 33 | 10,890 | 0 | python,django,gunicorn,django-manage.py | manage.py runserver is only a development server, it is not meant for production under any circumstance. You need to use something like Apache, uWSGI, NGINX or some other server to serve your django project once it's ready for deployment. | 0 | 0 | 0 | 0 | 2016-02-26T16:49:00.000 | 2 | 1 | false | 35,657,332 | 0 | 0 | 1 | 2 | I have been running my beginner Django projects with manage.py runserver. I see suggestions to use gunicorn instead. What is the difference ? |
Django: Difference between using server through manage.py and other servers like gunicorn etc. Which is better? | 35,660,663 | 79 | 33 | 10,890 | 0 | python,django,gunicorn,django-manage.py | nginx and gunicorn are probably the most popular configuration for production deployments. Before detailing why gunicorn is recommended over runserver, let's quickly clarify the difference between nginx and gunicorn, because both state that they are web servers.
NGINX should be your entrance point to the public, it's t... | 0 | 0 | 0 | 0 | 2016-02-26T16:49:00.000 | 2 | 1.2 | true | 35,657,332 | 0 | 0 | 1 | 2 | I have been running my beginner Django projects with manage.py runserver. I see suggestions to use gunicorn instead. What is the difference ? |
Is github3py thread-safe? | 35,702,676 | 0 | 0 | 77 | 0 | python,thread-safety,github3.py | To give you a more thorough answer, Aviv, since you're simply sharing instances and calling methods, then it is absolutely threadsafe. Some of the questions of requests thread-safety are mostly around cookies, their expiration, and their revocation. Cookies aren't used by github3.py to talk to the GitHub API so you sho... | 0 | 0 | 0 | 0 | 2016-02-28T13:01:00.000 | 2 | 1.2 | true | 35,682,844 | 1 | 0 | 1 | 1 | Does anytone knows if github3py is threadsafe.
Specifically:
GitHub.repository()
Repository.iter_pulls()
Repository.branch()
Repository.create_status()
None of the threads edit the objects, just share the instances and call the methods.
Thanks |
What is the best approach to design model fields that is like a list in Django? | 35,691,578 | 1 | 0 | 33 | 0 | python,django,list,model | I think the best way to organize your 'SysApp - documents' relationship, assuming that each document is related to only one sysapp, is to use ForeignKey, as you mentioned.
In that case you'll only have to create 2 models: the first one is SysApp with a name field and the second is Document with fields title, url to fi... | 0 | 0 | 0 | 0 | 2016-02-29T01:17:00.000 | 1 | 0.197375 | false | 35,690,489 | 0 | 0 | 1 | 1 | Let's say I have a model called 'SysApp'. Each system has 5 documents. Each document has fields:
Title
URL to the file (external url)
Description
Rather than defining multiple fields like
title_1,
url_1,
description_1,
title_2,
url_2,
description_2
(Hardcoded approach)
is there a better way to handle this ty... |
Tenancy and sub-tenancy in Django | 35,694,308 | 0 | 1 | 50 | 0 | python,django,django-models,multi-tenant | You need to look at foreign key based fields in particular the many to many field. You can then use manytomany through a role object which captures information about roles i.e.
See the django docs for excellent examples | 0 | 0 | 0 | 0 | 2016-02-29T07:01:00.000 | 1 | 0 | false | 35,693,644 | 0 | 0 | 1 | 1 | I'm having a SaaS application which needs a main user (like the owner of the business who would use the SaaS) to be the admin of that particular tenancy. Now the main user needs of have multiple sub users (like a user looking for sales, other for purchase, etc).
Now my question is single level tenancy is possible in D... |
postgres database: When does a job get killed | 35,707,179 | 3 | 1 | 2,227 | 1 | python,database,postgresql,sqlalchemy,flask-sqlalchemy | Just the message "killed" appearing in the terminal window usually means the kernel was running out of memory and killed the process as an emergency measure.
Most libraries which connect to PostgreSQL will read the entire result set into memory, by default. But some libraries have a way to tell it to process the resul... | 0 | 0 | 0 | 0 | 2016-02-29T17:01:00.000 | 2 | 0.291313 | false | 35,705,211 | 0 | 0 | 1 | 1 | I am using a postgres database with sql-alchemy and flask. I have a couple of jobs which I have to run through the entire database to updates entries. When I do this on my local machine I get a very different behavior compared to the server.
E.g. there seems to be an upper limit on how many entries I can get from the ... |
Calling bokeh api from python / flask for charts -- becoming slower with each call | 38,001,749 | 0 | 1 | 125 | 0 | python,charts,flask,bokeh | I also face this problem. It turns out Bokeh stores data in its curdoc across requests.
I fix this by manually clearing bokeh document everytime at the end of each request with: curdoc().clear() | 0 | 0 | 0 | 0 | 2016-02-29T22:51:00.000 | 1 | 0 | false | 35,711,344 | 0 | 0 | 1 | 1 | I am running a flask application which makes calls to a bokeh api for generating charts to be rendered in html. The first time I generate the chart, it is taking about 0.07s. The second time, about 0.14s. The third time about 0.21s, and so on. I must be doing something wrong. Wondering if anyone has any thoughts on how... |
How to make django task.py code editable in admin panel? | 35,730,732 | 0 | 0 | 53 | 0 | python,django | As Peter was saying it is definitely a bad idea. If you must do it, then below one might be little better:
Create a view to render a form, where user can choose the task name, class name, and then a text area to write his function or task (or) totally new task.py itself (as per your requirement).
Once submitted, in th... | 0 | 0 | 0 | 0 | 2016-03-01T01:02:00.000 | 1 | 0 | false | 35,712,823 | 0 | 0 | 1 | 1 | I have some functions as tasks in my tasks.py file in django and I want to be able to edit the code of each task in my administration panel. Is there any way of doing this. If possible, I would also like to be able to add more tasks in my tasks.py file directly through administration panel without having to go into tas... |
Run python script inside java on android | 59,486,412 | 1 | 5 | 3,858 | 0 | java,android,python | Running a python script inside android app is not practical at the moment, but what you can do is creating a HTTP web service for interpreting python and sending back the results to the android application.
Then it's just Android app communicating with a HTTP web service which is simpler than packing an interpreter.
Th... | 0 | 0 | 0 | 1 | 2016-03-01T06:28:00.000 | 1 | 1.2 | true | 35,716,086 | 0 | 0 | 1 | 1 | Is it possible to run "python" script inside "Java" in an android app?
The main app will be Java but some cryptography should be done in "python"
Is it possible to do this? |
Ckan backup and restore | 35,729,219 | 4 | 5 | 1,289 | 1 | python,ckan | Backup CKAN's databases (the main one and Datastore one if you use it) with pg_dump. If you use Filestore then you need to take a backup copy of the files in the directory specified by ckan.storage_path (default is /var/lib/ckan/default)
Restore the database backups (after doing createdb) using psql -f. Then run paster... | 0 | 0 | 0 | 0 | 2016-03-01T15:31:00.000 | 1 | 1.2 | true | 35,726,924 | 0 | 0 | 1 | 1 | I'm trying to write some documentation on how to restore a CKAN instance in my organization.
I have backuped and restored successfully CKAN database and resources folder but i don't know what i have to do with datastore db.
Which is the best practice?
Use pg_dump to dump the database or initialize it from the resources... |
Celery task history | 38,764,411 | 5 | 5 | 4,109 | 0 | python,celery,flower | You can use the persisent option,eg: flower -A ctq.celery --persistent=True | 0 | 1 | 0 | 0 | 2016-03-01T15:32:00.000 | 2 | 0.462117 | false | 35,726,948 | 0 | 0 | 1 | 1 | I am building a framework for executing tasks on top of Celery framework.
I would like to see the list of recently executed tasks (for the recent 2-7 days).
Looking on the API I can find app.backend object, but cannot figure out how to make a query to fetch tasks.
For example I can use backends like Redis or database. ... |
Django - What constitutes an app? | 35,732,320 | 1 | 2 | 100 | 0 | python,django | Python\Django is modular.
App should include just those models which usually solve 1 concrete task.
If some of models from p.1 can be usefull in other tasks, then probably would be better to create a new apps for those models. Ie if some models are shared between multiple tasks then there is a logic to make a new apps... | 0 | 0 | 0 | 0 | 2016-03-01T19:13:00.000 | 2 | 0.099668 | false | 35,731,438 | 0 | 0 | 1 | 1 | I'm build a Django app with a number of models (5-10). There would be an admin side, where an end-user manages the data, and then a user side, where other end-users can only read the data. I understand the point of a Django app is to encourage modularity, but I'm unsure as to "where the line is drawn" so-to-speak.
In ... |
Django - MySQL : 1146 Table doesn't exist | 35,777,867 | 1 | 0 | 2,782 | 1 | mysql,django,python-3.x,django-database | So here is the answer for all the django (or coding in general) noobs like me.
python manage.py createcachetable
I totally forgot about that and this caused all the trouble with "app_cache doesn't exist". At least in this case...
I changed my database to PostgreSQL, but I am sure it also helps with MySQL... | 0 | 0 | 0 | 0 | 2016-03-01T20:25:00.000 | 2 | 0.099668 | false | 35,732,758 | 0 | 0 | 1 | 2 | Hello everybody this is my first post,
I made a website with Django 1.8.9 and Python 3.4.4 on Windows 7. As I was using SQLite3 everything was fine.
I needed to change the database to MySQL. I installed MySQL 5.6 and mysqlclient. I changed the database settings and made the migration ->worked.
But when I try to registe... |
Django - MySQL : 1146 Table doesn't exist | 35,733,218 | 0 | 0 | 2,782 | 1 | mysql,django,python-3.x,django-database | I would assume this was an issue with permissions. As in the web-page connects with a user that doesn't have the proper permissions to create content.
If your tables are InnoDB, you'll get the table doesn't exist message. You need the ib* files in the root of the MySQL datadir (e.g. ibdata1, ib_logfile0 ib_logfile1)
If... | 0 | 0 | 0 | 0 | 2016-03-01T20:25:00.000 | 2 | 0 | false | 35,732,758 | 0 | 0 | 1 | 2 | Hello everybody this is my first post,
I made a website with Django 1.8.9 and Python 3.4.4 on Windows 7. As I was using SQLite3 everything was fine.
I needed to change the database to MySQL. I installed MySQL 5.6 and mysqlclient. I changed the database settings and made the migration ->worked.
But when I try to registe... |
Is the following principle the right for autobahn python? | 35,795,470 | 1 | 0 | 59 | 0 | python,c,html,websocket,autobahn | Autobahn|Python provides both a WebSocket implementation for Python and an implementation for a client for the WAMP protocol on top of that.
You can use the WebSocket part on its own to implement your WebSocket server. | 0 | 0 | 1 | 1 | 2016-03-02T09:08:00.000 | 1 | 0.197375 | false | 35,742,708 | 0 | 0 | 1 | 1 | I'm researching about WebSockets atm and just found Autobahn with Autobahn|Python.
I'm not sure that I understand the function of that toolset (?) correctly.
My intention is to use a WebSocket-Server for communication between a C program and a HTML client.
The idea is to let the C program connect via WebSocket to the ... |
Python Mobile Test on AWS Device Farm (M2Crypto Issue) | 35,782,735 | 0 | 0 | 96 | 0 | python,amazon-web-services,m2crypto | Device Farm requires your python test should be able to execute on Linux_X64 platform.
You could create and package your test bundle on linux_x64 platform, then try to run it on Device Farm. | 0 | 0 | 0 | 1 | 2016-03-03T14:39:00.000 | 1 | 0 | false | 35,775,144 | 0 | 0 | 1 | 1 | I'm working on Python Image Recognition test for Android devices. It works on local; but when I try to build it for AWS, I always get the following error:
copying M2Crypto\SSL__init__.py -> build\lib.win32-2.7\M2Crypto\SSL
running build_ext building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to S... |
Testing Django template with ajax GET request - ajax request isn't invoking | 35,795,049 | 1 | 0 | 277 | 0 | javascript,python,ajax,django,django-templates | The django.test.Client is not a browser, it just makes HTTP requests, thus doesn't know anything about ajax/javascript.
One of the following should help you
use django.test.Client and assert that
the template has the ajax call to the correct url, i.e.: assert that the response contains <script>myAjaxCallTo('/some/ur... | 0 | 0 | 0 | 0 | 2016-03-04T11:24:00.000 | 1 | 0.197375 | false | 35,794,831 | 0 | 0 | 1 | 1 | I've faced with some problem during implementing test for template rendering.
There are two views:
General
Block with required data
General(1) template displays some data. This template contains ajax GET call for retrieving data from additional view (2). I want to check these data in my template(1) with test.
I ... |
Change password form while session is deleted | 35,800,668 | 1 | 0 | 30 | 0 | python,django | The approach what you are following is not correct.
If you want to force the user to change the password, set the flag and if flag is true redirect the user to change the password.
If you kill the user will be redirected to login page by default in any web application.
Thanks. | 0 | 0 | 0 | 0 | 2016-03-04T16:03:00.000 | 1 | 0.197375 | false | 35,800,558 | 0 | 0 | 1 | 1 | Periodically, I force some users to log out (because their passwords have to be changed) and for that I delete their Session cookie. What's happening next is that these users are redirected to the login screen.
How could I implement their redirection to a template that the only thing they can do is to change their pass... |
Python temporary directory to execute other processes? | 35,809,112 | 1 | 1 | 1,712 | 0 | python,temp | tempfile.mkstemp creates a file that is normally visible in the filesystem and returns you the path as well. You should be able to use this to create your input and output files - assuming javac will atomically overwrite the output file if it exists there should be no race condition if other processes on your system do... | 0 | 0 | 0 | 0 | 2016-03-05T01:57:00.000 | 2 | 1.2 | true | 35,809,076 | 1 | 0 | 1 | 1 | I have a string of Java source code in Python that I want to compile, execute, and collect the output (stdout and stderr). Unfortunately, as far as I can tell, javac and java require real files, so I have to create a temporary directory.
What is the best way to do this? The tempfile module seems to be oriented towards ... |
lxml runs in interpreter but not through apache/mod_wsgi | 35,821,295 | 0 | 0 | 362 | 0 | python,django,apache,lxml,libxslt | Fixed by removing libexslt.so files from usr/lib64/. | 0 | 0 | 0 | 0 | 2016-03-05T21:48:00.000 | 1 | 0 | false | 35,820,328 | 0 | 0 | 1 | 1 | I have a django app that requires Python (3.4) lxml package. I had a fair amount of trouble building the c shared libraries libxslt and libxml2 that lxml depends on in my red hat server environment. However, pip install lxml now completes successfully and I can import and use lxml in the command line interpreter.
When ... |
What is django app usage? | 35,843,074 | 1 | 1 | 73 | 0 | python,django-models | Apps are logical modules. One app can contain several models. Your project could have users and blog apps. users would have User and Group models, blog would have Post, Tag and PostTag models.
Views within single app usually have same URL prefix and their own URL routing.
Within app all database migrations are execute... | 0 | 0 | 0 | 0 | 2016-03-07T11:45:00.000 | 1 | 0.197375 | false | 35,842,899 | 0 | 0 | 1 | 1 | I want to know if I've understand the main point of django app usage.
Every app has a models.py file which create tables in our database, correst?
For example I want to create a personal CMS. I should create an app, to create tables for my posts details, and should create an other app to creating tables for my users th... |
Is it a good practice to save images in the backend database in mysql/django? | 35,844,490 | 1 | 3 | 1,276 | 1 | python,mysql,django | The best way to do this is to store the images in your server in some specific, general folder for this images. After that you store a string in your DB with the path to the image that you want to load. This will be a more efficient way to do this. | 0 | 0 | 0 | 0 | 2016-03-07T12:54:00.000 | 3 | 0.066568 | false | 35,844,303 | 0 | 0 | 1 | 1 | I am trying to create my personal web page. So in that I needed to put in the recommendations panel , which contains recommendations by ex employees/friends etc.
So I was planning to create a model in django with following attributes:-
author_name
author_designation
author_image
author_comments
I have following quest... |
Run a script in background in flask | 35,866,759 | 1 | 0 | 1,153 | 0 | python,multithreading,flask | You can render a simple html file at your default route that make an Ajax request to a specific route which will start your script and when the script is finished return the data and catch them in your ajax request to display the data on your page. During the process of your script you can display a loader to show that... | 0 | 0 | 0 | 0 | 2016-03-08T11:44:00.000 | 1 | 0.197375 | false | 35,866,453 | 0 | 0 | 1 | 1 | I am writing an app using Flask that runs a shell script and displays its output in a web page. This works fine. The thing is when I run the script, it takes a long time and the page is loading during the whole time that the script is executed. What I want is that the script runs in the background and when it ends it d... |
Flask redirecting requests to urls containing '@' | 35,878,062 | 0 | 1 | 511 | 0 | python,flask,url-routing,werkzeug | It turns out that 9000 was right: the '@' sign is a perfectly legal character in the URL. As such, that shouldn't be what Flask was complaining about. Much less obvious than the conversion of '@' to '%40' in the redirected URL is that the trailing slash was missing from the initial request. When writing my question, I ... | 0 | 0 | 0 | 0 | 2016-03-08T20:25:00.000 | 1 | 1.2 | true | 35,877,333 | 0 | 0 | 1 | 1 | I am re-implementing a legacy system as a Flask app and must keep url patterns as they are. One of the urls includes a user's full email address directly (in other words, the email address is part of the url and not as a GET parameter).
When I send requests to this url, Flask automatically responds with a redirect to t... |
Live Video Encoding and Streaming on a Webpage | 35,886,856 | 0 | 6 | 8,409 | 0 | python,video,ffmpeg,video-streaming,http-live-streaming | You could use FFmpeg to mux the video stream in to H.264 in a mp4 container and then that can be directly used in a HTML5 video element. | 0 | 0 | 1 | 0 | 2016-03-08T23:56:00.000 | 2 | 0 | false | 35,880,417 | 0 | 0 | 1 | 1 | I am trying to show live webcam video stream on webpage and I have a working draft. However, I am not satisfied with the performance and looking for a better way to do the job.
I have a webcam connected to Raspberry PI and a web server which is a simple python-Flask server. Webcam images are captured by using OpenCV an... |
Django deployed app/project can't write to a file | 35,923,950 | 0 | 1 | 810 | 0 | python,django,apache,apache2.4 | The real solution is to install your data files in /srv/data/myapp or some such so that you can give the webserver user correct permissions to only those directories. Whether you choose to put your code in /var/www or not, is a separate question, but I would suggest putting at least your wsgi file there (and, of course... | 0 | 0 | 0 | 0 | 2016-03-10T17:39:00.000 | 1 | 0 | false | 35,923,494 | 0 | 0 | 1 | 1 | I am working on a Django based application whose location on my disk is home/user/Documents/project/application. Now this application takes in some values from the user and writes them into a file located in a folder which is under the project directory i.e home/user/Documents/project/folder/file. While running the dev... |
Writing personal translation app using my own database to work on android | 35,925,616 | 0 | 1 | 115 | 0 | java,android,python,android-studio,translate | Android studio covers basically every aspect you've mentioned. You'll probably need to google a lot to learn how to implement individual things.
Short guide: (research on your own how to do each step)
You can use SQLite database for storing your data.
Add your media (sound files) to resources and then play them or wha... | 0 | 0 | 0 | 0 | 2016-03-10T19:22:00.000 | 1 | 1.2 | true | 35,925,402 | 0 | 0 | 1 | 1 | I would like to make an app that lets you search for part of a word or phrase, then returns the closest results from a personal database of words I have learnt in another language. Once the results have been returned I would like the option to play the sound file with the associated results. I can write the database in... |
Dynamic bindings in Django template | 35,926,366 | 0 | 0 | 200 | 0 | django,python-2.7,django-templates | This isn't really a template question. Templates are rendered before they ever get to the browser, so there is quite simply no such thing as a dynamic templates in this sense (and, to be clear, this is a consequence of the way the web works, not a limitation of Django).
The only solution is javascript. If you don't wan... | 0 | 0 | 0 | 0 | 2016-03-10T19:58:00.000 | 1 | 1.2 | true | 35,926,056 | 0 | 0 | 1 | 1 | What is the idiomatic way to create dynamic bindings in a Django template? For example, I have a template that has a list of items along the left. This list is bound to a model in my view context and displayed with a {% for %} loop
On the right, is a form that is supposed to display the values of the selected row in ... |
Cannot install djangorestframework on ec2 instance with pip | 35,937,820 | 0 | 0 | 273 | 0 | python,amazon-ec2,django-rest-framework | The problem is pip will open a https connection to pyip. Re-check outbound security rule of the instance and add https rule | 0 | 0 | 0 | 0 | 2016-03-11T10:28:00.000 | 1 | 0 | false | 35,937,769 | 0 | 0 | 1 | 1 | I use a micro ec2 instance with python 2.7.10 installed.
When i try to install djangorestframework with "pip install djangorestframework", it failed and here is the log:
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to pypi.python.org tim... |
How to install BeautifulSoup4 for Python 2.7 while also having Python 3.4 installed? | 35,941,194 | 0 | 0 | 757 | 0 | python,windows,python-2.7,bs4 | I guess you can run pip2 install bs4 and pip3 install bs4 to install them separately on different python versions | 0 | 0 | 0 | 0 | 2016-03-11T13:05:00.000 | 1 | 1.2 | true | 35,941,011 | 0 | 0 | 1 | 1 | I have both Python 2.7.11 and Python 3.4.1 installed on my Windows 8.1 system. I had installed BeautifulSoup4 with pip to run a code (not mine). However, pip automatically installed bs4 to Python 3.4.1. (I checked that it was installed in C://Python34/lib/site-packages/bs4)
I have use the command prompt, change directo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.