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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PySerial - Max baud rate for platform (windows) | 41,058,265 | 2 | 3 | 3,411 | 0 | python,pic,pyserial,ftdi | So I found that the rounded numbers didn't work i.e. 100000, 200000, 250000 but the multiples of 115200 do. i.e. 230400, 460800
I tried to use 230400 at first but the baud rate my microcontroller can produce is either 235294 or 222222. 235294 yields an error of -2.1% and 222222 yields an error of 3.55%. I naturally pic... | 0 | 0 | 0 | 1 | 2016-12-07T16:45:00.000 | 1 | 0.379949 | false | 41,022,923 | 0 | 0 | 1 | 1 | I'm trying to get pySerial to communicate with a microcontroller over an FTDI lead at a baud rate of 500,000. I know my microcontroller and FTDI lead can both handle it as can my laptop itself, as I can send to a putty terminal at that baud no problem. However I don't get anything when I try to send stuff to my python ... |
microservices and multiple databases | 41,049,986 | 2 | 3 | 426 | 1 | python,django,rabbitmq,celery | I am wondering if there is any better way to do this?
"better" is entirely subjective. if it meets your needs, it's fine.
something to consider, though: don't store the same information in more than one place.
if you need an address, look it up from the service that provides address, every time.
this may be a performa... | 0 | 0 | 0 | 0 | 2016-12-08T16:06:00.000 | 1 | 0.379949 | false | 41,043,800 | 0 | 0 | 1 | 1 | i have written MicroServices like for auth, location, etc.
All of microservices have different database, with for eg location is there in all my databases for these services.When in any of my project i need a location of user, it first looks in cache, if not found it hits the database. So far so good.Now when location ... |
Google App Engine SDK path in linux for pycharm? | 41,059,077 | 3 | 2 | 1,232 | 0 | python,google-app-engine,pycharm,google-cloud-platform | The correct path to use is the platform/google_appengine/ directory, within the google-cloud-sdk installation directory, | 0 | 1 | 0 | 0 | 2016-12-09T11:09:00.000 | 2 | 1.2 | true | 41,059,076 | 0 | 0 | 1 | 1 | While configuring pycharm (professional) for Google App engine it asks for App Engine SDK path, while google now gives everything bundled in a Google cloud SDK. On choosing the cloud SDK directory, pycharm is saying it's invalid. What is the correct path for Google App engine SDK? |
Python/ Django- Internal Server Error after performing a soft reset | 41,061,561 | 0 | 0 | 429 | 0 | python,django,git | If you're getting a 'bad gateway', that means you're using something like Nginx or Apache to route requests to your app.
A Bad Gateway error means that Nginx (substitute Apache if appropriate, I'll just use nginx here) isn't getting a response from the app server - your runserver equivalent isn't serving the app, or t... | 0 | 0 | 0 | 0 | 2016-12-09T12:44:00.000 | 1 | 0 | false | 41,060,813 | 0 | 0 | 1 | 1 | I recently made some changes to my Python/ Django project, and this caused one of the pages to display a 'Bad Gateway' message in the browser. I was unable to resolve this, so tried doing a 'soft reset' to the last working commit I had made. However, I am now getting an Internal Server Error when trying to view the web... |
Link excel calculator to online HTML app? | 41,067,457 | 0 | 0 | 63 | 0 | python,html,css,excel,calculator | Does your work have office 365? You can host the excel file online for everyone to access. It works just like normal excel does but it is througt the online interface. Buttons and everything should work.
Math isn't hard to do with javascript and you can learn super quickly on codeacademy (it's the first thing they teac... | 0 | 0 | 0 | 0 | 2016-12-09T19:03:00.000 | 1 | 1.2 | true | 41,067,232 | 0 | 0 | 1 | 1 | I am trying to convert a large excel calculator into an online website for people to freely use.
I have been working on this project for a few months now, and the equations within the excel sheets that are used to derive the answers are too complicated for me to program it from the ground up.
Are there any easy ways ... |
How to find if a model was saved from Django Admin, or elsewhere | 41,083,650 | 1 | 2 | 808 | 0 | python,django,django-admin | Since you don't need to create the related model thanks to the presence of the InlineAdmin perhaps it would be better for you to remove the post_save signal receiver rather than adding more code inside post_save to determine where the save originated from.
That way you can just place a call to create_related_models in... | 0 | 0 | 0 | 0 | 2016-12-10T06:58:00.000 | 2 | 1.2 | true | 41,073,034 | 0 | 0 | 1 | 1 | Is there a way to identify if the current save() or post_save happened via Django Admin? I want to do something differently for models saved via Admin, than models saved from my Django Rest Framework API.
Specifically, I have a create_related_objects I call on post_save of model Transaction, to create related object Ca... |
Install Flask in Python 3.4+ NOT for python2.7 | 41,091,835 | 0 | 0 | 1,368 | 0 | python,flask,dependencies,virtualenv | If you are using Pycharm just switch to python 3, and there is a list of packages installed. Hit add(+), and look for flask
You can switch to python 3 by hitting file-> setting -> Project:Projectname -> Project Interpreter | 0 | 0 | 0 | 0 | 2016-12-11T21:31:00.000 | 2 | 0 | false | 41,091,357 | 1 | 0 | 1 | 1 | So, I know how to actually install flask, via pip install Flask
But, I'm running a virtualenv with python3.4. The problem is, Flask is in fact installed. The problem is though, it is installed for python2.7 and not python3.4 .
I did run this command with the virtualenv activated via source bin/activate , but it seems t... |
How to run python, java, php, nodejs,ruby applications on same vps? | 41,095,058 | 0 | 2 | 900 | 0 | python,ruby,node.js,apache,nginx | Any user can run any service on a VPS. Just make sure that you are not conflicting with available ports in your services. | 0 | 0 | 0 | 0 | 2016-12-12T03:17:00.000 | 3 | 0 | false | 41,093,725 | 0 | 0 | 1 | 1 | How to run python(Django,Flask), Java(spring),PHP, Nodejs(express),Ruby(rails) application on same VPS.If it is possible on VPS, can we do similar on Reseller Hosting where we have SSH Access.
I have readed on some other Articles they.. suggests to Use "Virtual Host" in Apache.
Also which one is better NGINX or Apac... |
I accidentally deleted django_admin_log and now i can not use the django admin | 47,960,936 | 0 | 1 | 2,274 | 1 | python,django,django-admin | After ./manage.py sqlmigrate admin 0001, please run python manage.py migrate. | 0 | 0 | 0 | 0 | 2016-12-12T05:56:00.000 | 3 | 0 | false | 41,094,926 | 0 | 0 | 1 | 2 | I get this error
"ProgrammingError at /admin/
relation "django_admin_log" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_ad..."
django_admin_log table does not exist in the database. Does anyone know how I can create it? I am not worried about deleting the data for my app.
wh... |
I accidentally deleted django_admin_log and now i can not use the django admin | 60,692,503 | 2 | 1 | 2,274 | 1 | python,django,django-admin | experienced the same issue, the best way is to copy the CREATE TABLE log, login to your database ./manage.py dbshell and Paste the content over there without adding the last line (COMMIT ) it will solve the problem and manually create the table for you. | 0 | 0 | 0 | 0 | 2016-12-12T05:56:00.000 | 3 | 0.132549 | false | 41,094,926 | 0 | 0 | 1 | 2 | I get this error
"ProgrammingError at /admin/
relation "django_admin_log" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_ad..."
django_admin_log table does not exist in the database. Does anyone know how I can create it? I am not worried about deleting the data for my app.
wh... |
How to limit number of active logins in Flask | 59,997,976 | 0 | 3 | 1,075 | 0 | python,authentication,flask,flask-security | There could be several ways off the top of my head you approach this, none of them striking a nice balance between simplicity and effectiveness:
One way could be to add a last_seen field to your User. Pick some arbitrary number(s) that could serve as a heuristic to determine whether someone is "active". Any sufficientl... | 0 | 0 | 0 | 0 | 2016-12-13T15:32:00.000 | 1 | 0 | false | 41,124,843 | 0 | 0 | 1 | 1 | I'm trying to write a basic Flask app that limits the number of active logins a user can have, a la Netflix. I'm using the following strategy for now:
Using Flask_Security
store a active_login_count field for my User class.
every time a successful login request is completed, the app increases the active_login_count by... |
PyCharm is terribly slow when editing HTML / CSS / JS | 41,154,218 | 6 | 6 | 2,026 | 0 | javascript,python,html,pycharm,jetbrains-ide | There are two solutions:
You can disable HTML / CSS / JS inspections in Preferences -> Editor -> Inspections.
If your project has a decent amount of third-party libraries (jquery, bootstrap etc.), this might be the reason. Don't index directories with these libraries: right click on a folder and then choose Mark Direc... | 0 | 0 | 0 | 0 | 2016-12-14T23:51:00.000 | 1 | 1.2 | true | 41,154,217 | 1 | 0 | 1 | 1 | PyCharm becomes nearly unresponsive in 5 minutes of editing HTML / CSS / JS code – even typing a single character causes a several seconds lag.
However, everything is absolutely fine when I work with Python. I don't close PyCharm for days and it works smooth.
Restarting PyCharm helps only for a few minutes. I'm on PyC... |
Transfer PDF files between servers in python | 41,170,783 | 1 | 0 | 1,341 | 0 | python,api,pdf | I wanted to share my solution to this, but give credit to @CoolqB for the answer. The key was including 'rb' to properly read the binary file and including the codecs library. Here are the final code snippets:
Client request:
response = requests.get('https://www.mywebsite.com/_api_call')
Server response:
f = codecs.... | 0 | 0 | 1 | 0 | 2016-12-15T00:10:00.000 | 2 | 0.099668 | false | 41,154,360 | 0 | 0 | 1 | 2 | We have two servers (client-facing, and back-end database) between which we would like to transfer PDFs. Here's the data flow:
User requests PDF from website.
Site sends request to client-server.
Client server requests PDF from back-end server (different IP).
Back-end server sends PDF to client server.
Client server ... |
Transfer PDF files between servers in python | 41,154,455 | 1 | 0 | 1,341 | 0 | python,api,pdf | As you said you have no code, that's fine, but I can only give a few suggestions.
I'm not sure how you're sending your files, but I'm assuming that you're using pythons open function.
Make sure you are reading the file as bytes (e.g. open('<pdf-file>','rb'))
Cut the file up into chunks and send it as one file, this wa... | 0 | 0 | 1 | 0 | 2016-12-15T00:10:00.000 | 2 | 1.2 | true | 41,154,360 | 0 | 0 | 1 | 2 | We have two servers (client-facing, and back-end database) between which we would like to transfer PDFs. Here's the data flow:
User requests PDF from website.
Site sends request to client-server.
Client server requests PDF from back-end server (different IP).
Back-end server sends PDF to client server.
Client server ... |
Bitwise in a client - server scenario miscalculating | 41,157,447 | 0 | 0 | 35 | 0 | python-2.7,sockets,actionscript-3,bit-shift,bitwise-or | the only way i know, is sending negative number from server for getting a same result, otherwise not possible to reversing it through server (i guess) | 0 | 0 | 0 | 0 | 2016-12-15T02:47:00.000 | 1 | 0 | false | 41,155,598 | 0 | 0 | 1 | 1 | I have been tasked with creating a server for a client. I have all of the clients' code, so using it, I must create a server.
The client has a particular piece of code in a function called readInt(num1); return num1 << 24 | num1 << 16 | num1 << 8 | num1, which is called every time the client expects a type = int in the... |
Does uber have an API which let user download invoice pdf? | 41,212,414 | 1 | 0 | 106 | 0 | python,uber-api | "Does uber have an API which let user download invoice pdf?" - No, that API does not exist. | 0 | 0 | 1 | 0 | 2016-12-15T11:59:00.000 | 1 | 1.2 | true | 41,163,658 | 0 | 0 | 1 | 1 | I have been searching for a way to get my past ride invoice. Is there any api which i can use to get my rides info/invoice. as i don't want to click on every ride and then. Just want to automate the boring stuff. |
what is _origin in odoo | 41,179,576 | 2 | 1 | 2,580 | 0 | python-2.7,openerp,odoo-10 | In an onchange context it is the old value/record which was used before the change. | 0 | 0 | 0 | 0 | 2016-12-15T13:10:00.000 | 1 | 1.2 | true | 41,165,008 | 0 | 0 | 1 | 1 | in odoo sale order line there is an onchange method _onchange_product_uom_qty() where they used a condition self.product_uom_qty < self._origin.product_uom_qty
Now my question is what does self._orgin is used for what does it return?
Note: 1. you can also find the origin in hr_appraisal module inside the onchange_colle... |
Running Python scripts inside Android Studio | 41,166,600 | 6 | 9 | 25,025 | 0 | python,android-studio | If you only need to run the scripts and not to edit them, the easiest way to do so is to configure an external tool through Settings | Tools | External Tools. This doesn't require the Python plugin or any Python-specific configuration; you can simply specify the command line to execute. External tools appear as items i... | 1 | 0 | 0 | 1 | 2016-12-15T14:19:00.000 | 1 | 1.2 | true | 41,166,406 | 0 | 0 | 1 | 1 | I am running Android Studio 2.2.3
I need to run Python scripts during my development to process some data files. The final apk does not need to run Python in the device.
At the moment I run the scripts from a terminal or from PyDev for Eclipse, but I was looking for a way of doing it from Android Studio.
There seems to... |
How do I configure the sqlite3 module to work with Django 1.10? | 41,196,939 | 1 | 0 | 197 | 1 | linux,django,python-3.x,ubuntu,sqlite | I figured out that this error was caused by me changing my python path to 3.5 from the default of 2.7. | 0 | 0 | 0 | 0 | 2016-12-16T05:17:00.000 | 1 | 0.197375 | false | 41,177,692 | 0 | 0 | 1 | 1 | So the issue is that apparently Django uses the sqlite3 that is included with python, I have sqlite3 on my computer and it works fine on its own. I have tried many things to fix this and have not found a solution yet.
Please let me know how I can fix this issue so that I can use Django on my computer.
:~$ python
Python... |
Usa parameter as collection name in a scrapy project | 41,194,752 | 0 | 0 | 79 | 0 | python,mongodb,scrapy | I've got an answer.
for example:
using -s collection_name=abc for scrapy crawl command, then get the parameter in pipelines.py using param = settings.get('collection_name').
This is also found in stackoverflow, but can't remember which ticket.
Hope this would help some one facing same problem. | 0 | 0 | 0 | 0 | 2016-12-16T07:52:00.000 | 1 | 0 | false | 41,179,622 | 0 | 0 | 1 | 1 | The spider is to crawl info on a certain B2B website, and I want it to be a webserver, where user sumbit a url then the spider starts crawl.
The url seems like: apple.b2bxxx.com, which is a minisite on a B2B website, where all the products are listed. The "apple" might be different because different companies use diffe... |
Scrapy and Selenium: Make scrapy wait for selenium? | 46,603,023 | 0 | 0 | 505 | 0 | python,selenium,scrapy,web-crawler | You can use DOWNLOAD_DELAY = 0.25 in settings.py,that the downloader should wait before downloading consecutive pages from the same website.
Another way you can use time.sleep() for delaying spider to get response from selenium. | 0 | 0 | 1 | 0 | 2016-12-16T13:38:00.000 | 1 | 0 | false | 41,185,693 | 0 | 0 | 1 | 1 | I have a spider that I am using to crawl a site. I only need javascript for one piece of my item. So I scrape part of the site with scrapy then open the URL in selenium. While the URL is opening scrapy continues. How do I make scrapy to wait on my selenium logic to finish?
Thanks in advance. |
Git- made changes on a local branch, checked out master, and master is now broken | 41,188,434 | 2 | 1 | 110 | 0 | python,django,git,master | Possible causes:
(Git) You forgot to git add files in the conceptCalendar branch, and they are still lying around when you checkout master.
(Python) You have stale .pyc files in your project. Remove them.
(Django) You forgot to makemigrations in the conceptCalendar branch
(Django) You ran migrate on the conceptCalenda... | 0 | 0 | 0 | 0 | 2016-12-16T16:11:00.000 | 1 | 1.2 | true | 41,188,326 | 0 | 0 | 1 | 1 | I am working on a Python/ Django project, using Git to manage my version control.
I recently made some changes on a branch called conceptCalendar3, and the changes I made broke my site.
I committed the changes to that branch, and then checked out master, which, I had branched from in order to create the conceptCalendar... |
Python reliable project setup: write data from a serial port to a database in a certain time interval | 41,216,333 | 0 | 0 | 120 | 1 | python,django,cron,serial-port | For detecting system shutdown compare time stamps of last reading taken to current reading's time stamp. If they differ by more than 15 minutes than something went wrong during the operation. | 0 | 0 | 0 | 0 | 2016-12-18T12:48:00.000 | 1 | 0 | false | 41,208,473 | 0 | 0 | 1 | 1 | The application should read data from a serial port every 15 minutes (using the Modbus Protocol) and put them into a database. The data can then be viewed and manipulated in a web interface. I'm using Windows (no server) with a RAID system to prevent data loss.
My current setup looks like this:
using pyserial and mini... |
Override settings.py for testing | 41,211,379 | 0 | 1 | 431 | 0 | python,testing,settings | I suppose the easiest way would be to move your settings.py to another folder for safekeeping and then make a new one, and edit that for debugging. | 0 | 0 | 0 | 1 | 2016-12-18T18:10:00.000 | 2 | 0 | false | 41,211,357 | 0 | 0 | 1 | 1 | I have my project settings in settings.py file. There are database names, user names, host names etc. defined there. In project files I do import settings and then use the constants where needed like settings.HOST. For unit testing I would like to use different settings. How should I override the settings? I am not usi... |
Deploying a Flask app with root privileges | 41,215,183 | 2 | 3 | 4,412 | 0 | python,apache,flask,mod-wsgi | I would not run the web server as root for security reasons.
Instead, I suggest to:
Add the web user to /etc/sudoers - no password. Ideally, only allow the commands you want to run as root.
run the command with sudo [command]
You mention deployment, if you are packaging this into an rpm, I would put the sudo defini... | 0 | 0 | 0 | 1 | 2016-12-19T02:32:00.000 | 1 | 1.2 | true | 41,215,036 | 0 | 0 | 1 | 1 | I host a flask web app on a Raspberry Pi that has controls for my LED light strip. It all works great when I run the server with python as the root user, but I am having difficulty deploying it with Apache mod_wsgi. I want to use htttps, so deploying it seems to be necessary, but Apache doesn't seem to allow running se... |
Django view execution order for same url pattern requests? | 41,219,364 | 4 | 1 | 64 | 0 | python,django,django-views | Django doesn't do anything at all. It is entirely up to the server, which has already determined (according to its configuration) whether to run Django in multiple processes and/or threads, and so distributes incoming requests among those. | 0 | 0 | 0 | 0 | 2016-12-19T09:19:00.000 | 1 | 0.664037 | false | 41,219,281 | 0 | 0 | 1 | 1 | Let we say two users access the same urls that lead two requests were send to django views. The question is, how does django deal with these two requests? Does them be handled in two different threads simultaneously or when one end it request-middleware-response life cycle then the other be handled? |
Redirects in Django | 41,260,630 | 1 | 0 | 46 | 0 | python,django,module,connection,access-denied | I find an answer for the first part of my question. I just used the import login_required. Just before the function homepage in /helpdesk/public.py and the function index in /helpdesk/kb.py, I put @login_required(login_url='/helpdesk/login/?next=/helpdesk/) and it worked !
Now I try to find the answer of the second par... | 0 | 0 | 0 | 0 | 2016-12-20T15:50:00.000 | 1 | 1.2 | true | 41,246,248 | 0 | 0 | 1 | 1 | I'm working on the Helpdesk module from Django.
I want people who try to access 192.168.x.xxx:8000/helpdesk/ are redirected to the login page: 192.168.x.xxx:8000/helpdesk/login/?next=/helpdesk/
I also want people who try to access an nonexistant page to be redirected to:
the homepage if connected, or
the login page i... |
Accessing Google App Engine Python App code in production | 41,268,471 | 1 | 5 | 1,805 | 0 | google-app-engine,google-app-engine-python | If you are using the standard environment, the answer is no, you can't really inspect or see the code directly. You've mentioned looking at it via Stackdriver Debugger, which is one way to see a representation of it.
It sounds like if you have a reason to be looking at the code, then someone in your organization should... | 0 | 1 | 0 | 0 | 2016-12-21T00:05:00.000 | 2 | 0.099668 | false | 41,253,187 | 0 | 0 | 1 | 1 | (Background: I am new to Google App Engine, familiar with other cloud providers' services)
I am looking for access/view similar to shell access to production node.
With a Python/Django based Google App Engine App, I would like to view the code in production.
One view I could find is the StackDriver 'Debug' view.
Howe... |
django press Enter and it show ^M | 41,256,129 | 6 | 9 | 786 | 0 | python,django | Better to reset the console frequently.
This is not a big problem but due to multiple terminals being not reset for long durations, such problem occurs. | 0 | 0 | 0 | 0 | 2016-12-21T04:00:00.000 | 2 | 1.2 | true | 41,254,869 | 0 | 0 | 1 | 1 | I want to change my models in django
when I execute python manage.py makemigrations ,it asks a question:
Did you rename the demoapp.Myblog model to Blog? [y/N] y^M^M^M
that I input y and press Enter,but it adds ^M to the line
I've looked around and apparently but I've got no choices
can anybody tell me how to fix i... |
Virtual Environment for Python Django | 41,279,917 | 7 | 8 | 15,405 | 0 | python,django,web-applications,web | Well, this is one of the most common questions among beginners. I, myself have faced the question and did build multiple projects without worrying about the virtual environment.
But, of late, I have realized the importance of using virtual environments. Some of the benefits of using virtual environments are:
Dependenc... | 0 | 0 | 0 | 0 | 2016-12-22T09:17:00.000 | 6 | 1.2 | true | 41,279,547 | 1 | 0 | 1 | 4 | I'm currently a novice in web programming. I've been working on this Django project lately, and I've been reading about virtual environments. At the start of my project, I was unable to set up a virtual environment, and so I proceeded with the project without it. My questions are
Whether or not this virtual environment... |
Virtual Environment for Python Django | 58,122,857 | 0 | 8 | 15,405 | 0 | python,django,web-applications,web | first we create virtual wrapper
pip install virtualenv wrapper-win
and after make wrapper environment now
create a virtual env-
mkvirtualenv envname
(command run only 64 bit python)
And if you want to start virtual env then set your workplace(Directory)
using Command Prompt and write command
workon envname | 0 | 0 | 0 | 0 | 2016-12-22T09:17:00.000 | 6 | 0 | false | 41,279,547 | 1 | 0 | 1 | 4 | I'm currently a novice in web programming. I've been working on this Django project lately, and I've been reading about virtual environments. At the start of my project, I was unable to set up a virtual environment, and so I proceeded with the project without it. My questions are
Whether or not this virtual environment... |
Virtual Environment for Python Django | 52,409,650 | 0 | 8 | 15,405 | 0 | python,django,web-applications,web | Virtual environment creates virtual installation of python and packages on your computer .
Say,if you have your web application .With pass of time the packages get updated and there are changes that sometimes break backwards compaatibility that your web application or web project may depend on
so what do you do if y... | 0 | 0 | 0 | 0 | 2016-12-22T09:17:00.000 | 6 | 0 | false | 41,279,547 | 1 | 0 | 1 | 4 | I'm currently a novice in web programming. I've been working on this Django project lately, and I've been reading about virtual environments. At the start of my project, I was unable to set up a virtual environment, and so I proceeded with the project without it. My questions are
Whether or not this virtual environment... |
Virtual Environment for Python Django | 41,280,016 | 3 | 8 | 15,405 | 0 | python,django,web-applications,web | In java all libs used can be packed into a war or jar file. The advantage is that you don't need to worry about the environments of the OS.
Python is a pure dynamic language. Without virtual environment, all the python libs need to be installed into system path and shared among all python project.
Imagine that you are... | 0 | 0 | 0 | 0 | 2016-12-22T09:17:00.000 | 6 | 0.099668 | false | 41,279,547 | 1 | 0 | 1 | 4 | I'm currently a novice in web programming. I've been working on this Django project lately, and I've been reading about virtual environments. At the start of my project, I was unable to set up a virtual environment, and so I proceeded with the project without it. My questions are
Whether or not this virtual environment... |
Python/Django - Where do I have to make methods that perform like DML? | 41,287,774 | 2 | 0 | 117 | 0 | python,django,database,standards | A common philosophy in Django is "fat models, thin views", so preferably you would put as much of this DML functionality as functions on your model classes. Since models.py already defines the structure of your data, it makes sense to put functions that manipulate your data in the same file as much as possible. | 0 | 0 | 0 | 0 | 2016-12-22T16:25:00.000 | 1 | 1.2 | true | 41,287,609 | 0 | 0 | 1 | 1 | 'Methods that perform like DML' means methods that change data in the database.
Is there a standard or guideline for that?
Below are my own guesses.
Collect all functions in file of which name is like 'data_access.py'
Contain functions in each class of models.py
There is no standard. No one will blame even if I make t... |
django - underscoring foreign keys - pros and cons | 41,290,255 | 0 | 1 | 76 | 0 | python,django,pep8 | There certainly is something you can do about it, if it bothers you that much. All relationship fields that automatically define a reverse relation also allow you to override that default by specifying related_name. So if you really don't like profile.profileattributegroup, define the one-to-one field with related_name... | 0 | 0 | 0 | 0 | 2016-12-22T17:26:00.000 | 1 | 0 | false | 41,288,716 | 0 | 0 | 1 | 1 | As PEP8 states, one should name classes that have several words with camelcase (e.g. ProfileAttributeGroup), and use underscores for variables (profile_attribute_group).
However when it comes to django and reverse relations (and templates), we are forced to use lowercased name of classes.
For example, if our ProfileAt... |
TensorFlow from Google - Data Security | 50,601,700 | 0 | 0 | 861 | 0 | python,machine-learning,tensorflow,deep-learning,google-developer-tools | Doesn't TF actually also uses google's models from cloud? I'm pretty sure google uses cloud data to provide better models for TF.
I'd recommend you to stay away from it. Only by writing your models from scratch you will learn to do useful stuff with it long term. I can also recommend weka for java, it's open source an... | 0 | 0 | 0 | 0 | 2016-12-23T09:57:00.000 | 2 | 0 | false | 41,299,126 | 0 | 1 | 1 | 1 | Does anyone have any idea whether Google collects data that one supplies to Tensorflow? I mean it is open source, but it falls under their licences. |
How do i retrieve browsers history in python django? | 41,331,613 | 0 | 0 | 399 | 0 | django,python-2.7 | There is no way to do what you want, by design. | 0 | 0 | 0 | 0 | 2016-12-26T09:25:00.000 | 2 | 0 | false | 41,328,993 | 0 | 0 | 1 | 1 | I want to display all the Internet History Information of a system using Python? |
How to profile django channels? | 46,773,111 | 0 | 18 | 1,604 | 0 | python,django,profiling,django-channels,daphne | Why not stick a monitoring tool something like Kibana or New Relic and monitor why and what's taking so long for a small payload response. It can tell you the time spent on Python, PostgreSQL and Memcache (Redis). | 0 | 0 | 0 | 0 | 2016-12-26T12:49:00.000 | 2 | 0 | false | 41,331,567 | 0 | 0 | 1 | 1 | My technology stack is Redis as a channels backend, Postgresql as a database, Daphne as an ASGI server, Nginx in front of a whole application. Everything is deployed using Docker Swarm, with only Redis and Database outside. I have about 20 virtual hosts, with 20 interface servers, 40 http workers and 20 websocket worke... |
Django 1.10 Create Model Tables Automatically | 41,338,383 | 1 | 0 | 292 | 1 | database,sqlite,python-3.x,django-models | I think it's not a good idea to create a table for each user. This may cause bad performance and low security. Why don't you create a table named userInfo and put user.userID as a foreign key? | 0 | 0 | 0 | 0 | 2016-12-27T02:16:00.000 | 2 | 0.099668 | false | 41,338,208 | 0 | 0 | 1 | 1 | I am wondering if there is any way to create a new model table in SQLite with Django 1.10 (like writing general python code) without having to specify in the models.py. The situation is if there is a new member registered on my website, then I will create a new model table for them to hold their data. Specifically:
ste... |
Django: Get user's input in textarea and display them on page | 41,341,521 | 0 | 0 | 375 | 0 | python,html,django | In your view add handle for POST requests and in that case render your template with template variable of your POST data. | 0 | 0 | 0 | 0 | 2016-12-27T07:45:00.000 | 1 | 1.2 | true | 41,341,113 | 0 | 0 | 1 | 1 | How to get input from textarea and display them onto my webpage immediately after submit on Django? |
How to check if there are pending migrations when using SQLAlchemy/Alembic? | 41,357,149 | 7 | 8 | 4,164 | 1 | python,sqlalchemy,flask-sqlalchemy,alembic,flask-migrate | You can figure out if your project as at the latest migration with the current subcommand:
Example output when you are at the latest migration:
(venv) $ python app.py db current
f4b4aa1dedfd (head)
The key thing is the (head) that appears after the revision number. That tells you that this is the most recent migration... | 0 | 0 | 0 | 0 | 2016-12-27T10:24:00.000 | 3 | 1 | false | 41,343,316 | 0 | 0 | 1 | 1 | We're using SQLAlchemy and Alembic (along with Flask-SQLAlchemy and Flask-Migrate). How to check if there are pending migrations?
I tried to check both Alembic's and Flask-Migrate's documentation but failed to find the answer. |
AWS RDS save snapshot of selected tables | 41,363,444 | 1 | 0 | 540 | 1 | python,amazon-web-services,snapshot,boto3,rds | This is not possible using the AWS RDS snapshot mechanism, and it isn't possible using the AWS SDK. It is possible using the API for the specific database engine you are using. You would need to specify what database you are using for further help. | 0 | 0 | 0 | 0 | 2016-12-28T11:25:00.000 | 1 | 0.197375 | false | 41,361,091 | 0 | 0 | 1 | 1 | I'm trying to save a snapshot of several tables programatically in python, instead of all DB.
I couldn't find the API (in boto/boto3) to do that.
Is it possible to do? |
How to send bulk sms on whatsapp | 41,365,717 | 0 | 0 | 1,399 | 0 | python,whatsapp | The error you get clearly points out the nature of the challenge you are facing: it has to do with your version of yowsup-cli; it's an old version.
It means that your project requires a version of yowsup-cli higher than what you currently have so as to work effectively as require.
What you need to do so as to resolve i... | 0 | 0 | 1 | 1 | 2016-12-28T15:25:00.000 | 2 | 0 | false | 41,364,998 | 0 | 0 | 1 | 2 | I want to send bulk SMS on WhatsApp without creating broadcast list.
For that reason, I found pywhatsapp package in python but it requires WhatsApp client registration through yowsup-cli.
So I've run yowsup-cli registration -r sms -C 00 -p 000000000000 which resulted in the error below:
INFO:yowsup.common.http.wareque... |
How to send bulk sms on whatsapp | 41,424,293 | 0 | 0 | 1,399 | 0 | python,whatsapp | The problem is with the http headers that are sent to whatsapp servers, these are found in env/env.py
The name of headers are manually provided, therefore due to new updates whatsapp servers only serve or authenticate to updated devices which is identified with their http/https/etc headers, in this case you need to upd... | 0 | 0 | 1 | 1 | 2016-12-28T15:25:00.000 | 2 | 0 | false | 41,364,998 | 0 | 0 | 1 | 2 | I want to send bulk SMS on WhatsApp without creating broadcast list.
For that reason, I found pywhatsapp package in python but it requires WhatsApp client registration through yowsup-cli.
So I've run yowsup-cli registration -r sms -C 00 -p 000000000000 which resulted in the error below:
INFO:yowsup.common.http.wareque... |
Python Package Paths :: Finding Directories that Should Be .py Files | 41,373,629 | 2 | 2 | 45 | 0 | python,django | If you're looking for the source of module foo.bar, it can be one of the two:
foo/bar.py
foo/bar/__init__.py
Also note that often upper-level modules re-export selected names imported from deeper-down modules: a name may be merely imported, not otherwise defined; e.g. django.db does a lot of this. | 0 | 0 | 0 | 0 | 2016-12-29T04:00:00.000 | 1 | 0.379949 | false | 41,372,955 | 0 | 0 | 1 | 1 | As I work through the Django tutorials, I like to see with my own eyes the module and class/attribute that I am inheriting via import by going to the source code at Github.
However, and I have attached pics to illustrate that I (think) I went to the right place, but the files seem to be missing.
For example, in Django... |
How to solve [Errno 11] Resource temporarily unavailable using uwsgi + nginx | 44,000,160 | 0 | 0 | 1,657 | 0 | python,django,uwsgi | You can increase 'listen' value in uwsgi configure file.
The default value is 100 which is too small. | 0 | 1 | 0 | 0 | 2016-12-29T09:46:00.000 | 2 | 0 | false | 41,377,059 | 0 | 0 | 1 | 1 | I am using uwsgi with this configuration :
net.core.somaxconn = 1024
net.core.netdev_max_backlog=1000
I got resource temporarily unavailable issue. How to resolve this issue?
df -h
Filesystem Size Used Avail Use% Mounted on /dev/xvda1
7.8G 2.1G 5.6G 28% / devtmpfs
1.9G 12K 1.9G 1% /dev tmpfs
1.9G... |
installing sklearn version 0.18.1 in Apache web server | 41,383,430 | 0 | 0 | 362 | 0 | python,apache,flask,scikit-learn | Use anaconda. It will save you so much time with these annoying dependency issues. | 0 | 0 | 0 | 0 | 2016-12-29T13:25:00.000 | 1 | 0 | false | 41,380,710 | 0 | 1 | 1 | 1 | I am trying to install the latest version (0.18.1) of sklearn for use in a web app
I am hosting my webapp with apache web server and flask
I have tried sudo apt-get -y install python3-sklearn and this works but installs an older version of sklearn (0.17)
I have also tried pip3 and easy_install and these complete the in... |
Flask with mod_wsgi - Cannot call my modules | 41,394,185 | 0 | 0 | 1,008 | 0 | python,flask,undefined,global,mod-wsgi | No main function call with mod_wsgi was the right answer. I do not implemented my required modules in the wsgi file,
but on top of the flask app. | 0 | 1 | 0 | 0 | 2016-12-29T14:32:00.000 | 1 | 0 | false | 41,381,705 | 0 | 0 | 1 | 1 | I have changed my application running with flask and python2.7 from a standalone solution to flask with apache and mod_wsgi.
My Flask app (app.py) includes some classes which are in the directory below my app dir (../).
Here is my app.wsgi:
#!/usr/bin/python
import sys
import logging
logging.basicConf... |
Differences between rendering HTML in PyCharm and a text editor (Sublime Text) | 41,388,131 | 0 | 0 | 114 | 0 | python,html,css,pycharm | Let me try a lucky guess since I don't know what is exactly rendering different: it could be the Encoding of the file, you can try and change in Sublime selecting a different enconding type to save the file to match the file saved in pycharm.
File>Save with encoding>[select]
If both are completely equal is the only thi... | 0 | 0 | 0 | 0 | 2016-12-29T22:22:00.000 | 2 | 0 | false | 41,388,006 | 0 | 0 | 1 | 2 | I've got exactly the same files (HTML + CSS), in both PyCharm and Sublime Text, and the results of rendering these in Google Chrome is completely different.
Editing CSS doesn't have any affect on the results of rendering the HTML.
I have to make the project using Python Flas, but I want to start from HTML and CSS.
Doe... |
Differences between rendering HTML in PyCharm and a text editor (Sublime Text) | 41,388,349 | 0 | 0 | 114 | 0 | python,html,css,pycharm | When we run PyCharm project it give us the same link and we have to clear cache or cookies every time we open this link | 0 | 0 | 0 | 0 | 2016-12-29T22:22:00.000 | 2 | 1.2 | true | 41,388,006 | 0 | 0 | 1 | 2 | I've got exactly the same files (HTML + CSS), in both PyCharm and Sublime Text, and the results of rendering these in Google Chrome is completely different.
Editing CSS doesn't have any affect on the results of rendering the HTML.
I have to make the project using Python Flas, but I want to start from HTML and CSS.
Doe... |
Web Dialog box used to capture a full file path / UNC | 41,450,857 | 0 | 1 | 135 | 0 | javascript,jquery,python,jqwidget | I had to resort to this.
The application's user interface is posting to methods back on the site's controllers.
Then code executing on the site's server (Python) is providing the user's interface lists of folders and files on the file server's shares.
With some effort I will be able to provide the user with a rich and ... | 0 | 0 | 0 | 0 | 2016-12-31T02:39:00.000 | 1 | 1.2 | true | 41,404,967 | 0 | 0 | 1 | 1 | I'm building a browser application in web2py (Python based CMS). One requirement this application has is to enable is the user to browse to a folder within the local network or local drive. The user selects a folder, that selection becomes a string that I record in the application's database. File selection is entir... |
Updating which python my django app uses | 41,433,294 | 1 | 0 | 96 | 0 | django,python-2.7 | Create a new virtualenv using Python 2.7. Use the -p flag to point to the python installation you want for that virtual environment, and then pip install django within that virtual environment. | 0 | 0 | 0 | 0 | 2017-01-02T19:40:00.000 | 1 | 0.197375 | false | 41,432,445 | 1 | 0 | 1 | 1 | The django app running on localhost in a virtualenv uses the default python version 2.7.3 that is under /usr/bin/ but I installed Python 2.7.9 under ~/.opt/bin/python2.7. I updated the $PATH but I want the django app to use the locally installed python version by default.
Please help me understand how to make that happ... |
Large memory Python background jobs | 41,469,303 | 0 | 5 | 1,222 | 0 | python,mongodb,heroku,flask,python-rq | It turns out that the solution that worked for is to save the data to Amazon S3 storage, and then pass the URI to function in the background task. | 0 | 0 | 0 | 0 | 2017-01-04T10:35:00.000 | 2 | 0 | false | 41,461,708 | 0 | 0 | 1 | 2 | I am running a Flask server which loads data into a MongoDB database. Since there is a large amount of data, and this takes a long time, I want to do this via a background job.
I am using Redis as the message broker and Python-rq to implement the job queues. All the code runs on Heroku.
As I understand, python-rq uses ... |
Large memory Python background jobs | 41,469,731 | 7 | 5 | 1,222 | 0 | python,mongodb,heroku,flask,python-rq | Since you mentioned in your comment that your task input is a large list of key value pairs, I'm going to recommend the following:
Load up your list of key/value pairs in a file.
Upload the file to Amazon S3.
Get the resulting file URL, and pass that into your RQ task.
In your worker task, download the file.
Parse the... | 0 | 0 | 0 | 0 | 2017-01-04T10:35:00.000 | 2 | 1.2 | true | 41,461,708 | 0 | 0 | 1 | 2 | I am running a Flask server which loads data into a MongoDB database. Since there is a large amount of data, and this takes a long time, I want to do this via a background job.
I am using Redis as the message broker and Python-rq to implement the job queues. All the code runs on Heroku.
As I understand, python-rq uses ... |
How do I use crawler if I know the target web-page and file extension but not knowing the file name? | 41,653,258 | 0 | 1 | 50 | 0 | python,html,nginx,web-crawler | You can't crawl webpages if you don't know how to get to them.
If I understood what you meant, you want to access pages that are accessible in a directory whose index page is not (because you get a 403).
Before you give up, you can try the following:
check if the main search engines link to the pages inside the direct... | 0 | 0 | 0 | 0 | 2017-01-04T14:54:00.000 | 1 | 0 | false | 41,466,768 | 0 | 0 | 1 | 1 | I have a web-page here that I need to crawl. It looks like this:
www.abc.com/a/b/,
and I know that under the /b directory, there are some files with .html extensions I need. I know that I have access to those .html files, but I have no access to www.abc.com/a/b/. So, without knowing the .html file name, how can I cr... |
Error Making POST to ServiceM8 | 41,469,658 | 1 | 0 | 41 | 0 | python,django,python-requests | I was trying to pass the company id as company_uuid. I changed it to just company_id, and it worked perfectly. | 0 | 0 | 0 | 0 | 2017-01-04T17:04:00.000 | 1 | 0.197375 | false | 41,469,446 | 0 | 0 | 1 | 1 | I'm getting the following error making a POST request to ServiceM8:
{'Content-Type': 'text/html;charset=UTF-8', 'Content-Length': '343', 'Connection': 'keep-alive', 'Date': 'Wed, 04 Jan 2017 16:57:31 GMT', 'Server': 'Apache', 'X-Frame-Options': 'SAMEORIGIN', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 49ccc390fa499... |
Django: Concurrent access to settings.py | 41,549,703 | 1 | 0 | 143 | 0 | python,django,concurrency | as e4c5 mentioned, conventionally settings.py is pretty light on logic. The loading mechanism for settings is pretty obscure and, I personally, like to stay away from things that are difficult to understand and interact with :)
You absolutely have to care about concurrency. How are you running your application? It's... | 0 | 0 | 0 | 0 | 2017-01-05T12:28:00.000 | 2 | 1.2 | true | 41,485,130 | 1 | 0 | 1 | 2 | I am not sure whether I have to care about concurrency, but I didn't find any documentation about it.
I have some data stored at my settings.py like ip addresses and each user can take one or give one back. So I have read and write operations and I want that only one user read the file at the same moment.
How could I ... |
Django: Concurrent access to settings.py | 41,485,205 | 1 | 0 | 143 | 0 | python,django,concurrency | And yes, I want to store the data at the settings.py.
No you definitely don't want to do that. the settings.py file is configuring django and any pluggable apps that you may use with it. it's not intended to be used as a place for dumping data. Data goes into a database.
And don't forget that the settings.py file is u... | 0 | 0 | 0 | 0 | 2017-01-05T12:28:00.000 | 2 | 0.099668 | false | 41,485,130 | 1 | 0 | 1 | 2 | I am not sure whether I have to care about concurrency, but I didn't find any documentation about it.
I have some data stored at my settings.py like ip addresses and each user can take one or give one back. So I have read and write operations and I want that only one user read the file at the same moment.
How could I ... |
Troubleshooting API timeout from Django+Celery in Docker Container | 41,668,121 | 0 | 1 | 472 | 0 | python,django,docker,containers,celery | You can shell into the running container and check things out. Is the celery process still running, etc...
docker exec -ti my-container-name /bin/bash
If you are using django, for example, you could go to your django directory and do manage.py shell and start poking around there.
I have a similar setup where I run mult... | 0 | 1 | 0 | 0 | 2017-01-05T12:33:00.000 | 1 | 0 | false | 41,485,251 | 0 | 0 | 1 | 1 | I have a micro-services architecture of let say 9 services, each one running in its own container.
The services use a mix of technologies, but mainly Django, Celery (with a Redis Queue), a shared PostgreSQL database (in its own container), and some more specific services/libraries.
The micro-services talk to each other... |
Use django for one page on a website? | 41,490,025 | 2 | 1 | 2,061 | 0 | python,django | If all you wanted to do was create a static page (something simple that queries a database and displays results with no user input) then PHP would definitely be much easier. It's much, much, MUCH easier to deploy than web apps-- just drop your .php files in /var/www/html and you're set. Apache runs on anything.
Once yo... | 0 | 0 | 0 | 0 | 2017-01-05T15:47:00.000 | 1 | 0.379949 | false | 41,489,105 | 0 | 0 | 1 | 1 | I have a small app I would like to build as a project to learn more about web development. Its an app where people can register etc, and add information about themselves (database needed) and their location on a webmap (using leaflet library). The app will be a single page application that the user navigate to via a li... |
Django/Python Library for importing and producing Excel documents? | 41,498,821 | 1 | 0 | 199 | 1 | python,django,excel | I think a combination of Pandas and openpyxl will do the trick! | 0 | 0 | 0 | 0 | 2017-01-06T04:11:00.000 | 2 | 0.099668 | false | 41,498,803 | 0 | 0 | 1 | 1 | Looking for an Excel library for Django and Python with specific requirements.
There looks to be a number of libraries for Django and Python that enable the user to upload an Excel document into the database.
What I am wondering is if there is a library that allows you to create an Excel document and export with condit... |
Temporary failure in name resolution -wget in linux | 41,500,665 | 0 | 1 | 5,012 | 0 | python,linux,api,wget | This is tricky not knowing with which options you are calling wget and no log output, but since it seems to be a dns issue I would explicitly pass the --dns-servers=your.most.reliable.server to wget. If it persists I would also pass --append-output=logfile and examine logfile for further clues. | 0 | 1 | 1 | 0 | 2017-01-06T06:49:00.000 | 2 | 0 | false | 41,500,455 | 0 | 0 | 1 | 2 | Im running python code solution (automation) in linux
As part of the test im calling different api (rest) and connecting to my sql db.
I'm running the solution 24/7
The soultion does
Call api with wget
Every 1 min samples the db with query for 60 min max
Call api again with wget
Every 1 min samples dc for 10 mins max... |
Temporary failure in name resolution -wget in linux | 62,781,058 | 0 | 1 | 5,012 | 0 | python,linux,api,wget | You can ignore the fail:
wget http:/host/download 2>/dev/null | 0 | 1 | 1 | 0 | 2017-01-06T06:49:00.000 | 2 | 0 | false | 41,500,455 | 0 | 0 | 1 | 2 | Im running python code solution (automation) in linux
As part of the test im calling different api (rest) and connecting to my sql db.
I'm running the solution 24/7
The soultion does
Call api with wget
Every 1 min samples the db with query for 60 min max
Call api again with wget
Every 1 min samples dc for 10 mins max... |
Can I use xvfb with AWS Lambda? | 41,510,034 | 1 | 2 | 2,074 | 0 | python,amazon-web-services,aws-lambda | No, this breaks the lambda paradigm of having a fully built container ready to go.
Also, anything you'd do with xvfb is probably going to be slow. As a general rule lambdas should execute in under a second, otherwise you should just have a server.
I would recommend creating a docker container and making an auto-scalin... | 0 | 0 | 1 | 0 | 2017-01-06T16:25:00.000 | 2 | 0.099668 | false | 41,509,856 | 0 | 0 | 1 | 1 | I would like to offload some code to AWS Lambda that grabs a part of a screenshot of a URL and stores that in S3. It uses chromium-browser which in turn needs to run in xvfb on Ubuntu. I believe I can just download the Linux 64-bit version of chromium-browser and zip that up with my app. I'm not sure if I can do tha... |
flask: command not found - flask 0.12 | 41,521,516 | 5 | 3 | 9,753 | 0 | python,flask | Fixed by running python3 -m flask. | 0 | 0 | 0 | 0 | 2017-01-07T12:22:00.000 | 2 | 1.2 | true | 41,521,392 | 1 | 0 | 1 | 1 | I have just installed a fresh copy of Ubuntu 16.04 LTS, and installed flask using pip3 install flask. When I run pip3 list Flask 0.12 appears in the list.
However, when I attempt to run flask, I get the error flask: command not found.
I have also installed using pip and not pip3 but to no avail. Any suggestions? |
Can you put static folder in project root, rather than app root? | 41,525,185 | 1 | 1 | 70 | 0 | python,django,python-2.7 | Django doesn't say any such thing. Put the static folder wherever you want, as long as you include it in STATICFILES_DIRS so that collectstatic will find it. | 0 | 0 | 0 | 0 | 2017-01-07T18:29:00.000 | 2 | 0.099668 | false | 41,524,979 | 0 | 0 | 1 | 1 | For example, if I want to use the same style.css for all my apps, where should I put the static folder? I'm pretty sure Django site says to put it in the application folder? But what if I have multiple apps? |
Why doesn't "python" command work in virtualenv? | 41,533,415 | 0 | 2 | 99 | 0 | python,django,virtualenv | Because of the way virtualenvs work, Django was not 'installed' in said env.
The reason ./manage.py startapp firstapp worked is because the ./ indicated that it was an executable file, and hence handled by the system as such. That way, modules are accessible, as the program is ran outside of the env
Hope this helped! | 0 | 0 | 0 | 0 | 2017-01-08T12:26:00.000 | 1 | 1.2 | true | 41,532,668 | 1 | 0 | 1 | 1 | Before asking, I should mention that this is NOT a problem or a bug, this is just a question to widen my knowledge.
When I was working on a Django project (I'm quite new to all these things so don't beat, please) I activated my virtualenv, installed django module and started a new Django project by using django-admin.p... |
Dedicated web service for web app (Python/Django) | 41,542,658 | 0 | 2 | 347 | 0 | python,django,rest | By creating dedicated API's will help you in future if you decide to build mobile application, that case no need to write new API's as you can consume your existing API's. By doing this your are not repeating your server side codes. Only have to write the client side code. And coming to performance only load time will ... | 0 | 0 | 0 | 0 | 2017-01-08T12:31:00.000 | 1 | 0 | false | 41,532,714 | 0 | 0 | 1 | 1 | Let's assume that I want to create a simple todo list web application. I am thinking about creating RESTful web services which will be used my the web application and which will be providing all functionalities concerning managing todo list and tasks. I have two concerns:
Is there a sense in creating dedicated web ser... |
How don't change '/media/' on heroku after "git push ..." | 41,545,127 | 2 | 0 | 125 | 0 | python,django,git,heroku,git-push | /media is for user-uploaded files. These must not be stored in the Heroku filesystem.
Heroku creates a new dyno each time you deploy your code, as well as whenever you run a management command and at irregular times otherwise. Each new dyno has its own filesystem which is not shared with other ones and only contains th... | 0 | 0 | 0 | 0 | 2017-01-09T09:35:00.000 | 1 | 1.2 | true | 41,544,873 | 0 | 0 | 1 | 1 | Help me please.
I have django app on Heroku.
I want that after $ git push heroku master folder /media/ on Heroku don't change.
Thank you. |
Should I add Django admin static files to my git repo? | 41,558,803 | 31 | 24 | 7,555 | 0 | python,django,git,django-admin | While you can absolutely check these files in, I typically recommend not checking in the collected static files into git (we use .gitignore to ignore them). Instead, we call collectstatic during our build/deploy steps so that if anyone ever adds new static files, they are collected and copied to the proper output dire... | 0 | 0 | 0 | 0 | 2017-01-09T22:45:00.000 | 1 | 1.2 | true | 41,558,258 | 0 | 0 | 1 | 1 | I ran manage.py collectstatic on my webapp and now I have a new static folder with only Django admin files (so far I've been using just CDNs for my project CSS and JS files). Should I track these admin static files on my git repo? What's the best practise? |
Python objects lose state after every request in nginx | 41,559,760 | 2 | 1 | 210 | 0 | python,django,nginx,wsgi,gunicorn | Gunicorn has a preforking worker model -- meaning that it launches several independent subprocesses, each of which is responsible for handling a subset of the load.
If you're relying on internal application state being consistent across all threads involved in offering your service, you'll want to turn the number of wo... | 0 | 0 | 0 | 1 | 2017-01-10T00:47:00.000 | 1 | 1.2 | true | 41,559,470 | 0 | 0 | 1 | 1 | This is really troublesome for me. I have a telegram bot that runs in django and python 2.7. During development I used django sslserver and everything worked fine. Today I deployed it using gunicorn in nginx and the code works very different than it did on my localhost. I tried everything I could since I already starte... |
Making Django's CBV's get an instance method | 41,565,380 | 0 | 0 | 65 | 0 | python,django,django-class-based-views | As I said, get is an instance method.
But you are confusing responsibilities here. A class should have one responsibility only. The view class has the responsibility of responding to the request and returning a response; this is quite separate from the connection to the instrument. That should be a separate class, whic... | 0 | 0 | 0 | 0 | 2017-01-10T07:49:00.000 | 1 | 0 | false | 41,563,696 | 0 | 0 | 1 | 1 | I'm currently building a Django app which uses a singleton object.
I want to save this object as a CBV variable because I dont want to initialize it for every 'get' call.
My question in short - can you make a CBV's get function an instance method instead of a classmethod?
And if so, can I save a variable as an instance... |
Define own header in webpy | 41,726,066 | 1 | 1 | 253 | 0 | python,web.py | Headers aren't part of web.input(), they're part of the "environment".
You can add headers, to be sent to your client using web.header('My-Header', 'header-value').
You can read headers sent by your client using: web.ctx.env.get('MY_HEADER') (Note all-caps, and use of underline rather than dash). | 0 | 0 | 1 | 0 | 2017-01-10T10:08:00.000 | 1 | 0.197375 | false | 41,566,222 | 0 | 0 | 1 | 1 | I look after many links to find how can I define my proprietary header in webpy. Can you help me, please. I need to define my own http header like ("X-UploadedFile") and then use it with web.input() |
Debugging Bokeh serve application using PyCharm | 44,185,703 | 5 | 11 | 4,506 | 0 | python,bokeh | bokeh can also be run via python -m bokeh
given that, you could open up the Run/Debug Configuration dialog and set your interpreter options to -m bokeh serve --show and your script will run as-is | 0 | 0 | 0 | 0 | 2017-01-10T13:43:00.000 | 6 | 0.16514 | false | 41,570,318 | 0 | 0 | 1 | 1 | Bokeh serve allows to write fast web apps with plots and widgets.
How can I debug the python code when I use bokeh serve --show code.py? |
Django - make admin fields invisible to some users | 41,578,308 | 3 | 0 | 248 | 0 | python,django | Just don't give them superuser rights. Superuser means they have all rights automatically, which isn't what you want.
Then add edit, add, delete rights for the models they are allowed to edit, add and delete. You can create a group that you give these rights to, then add the users to that group.
If a user doesn't have ... | 0 | 0 | 0 | 0 | 2017-01-10T20:25:00.000 | 1 | 1.2 | true | 41,577,756 | 0 | 0 | 1 | 1 | TL;DR I'd like to be able to disable certain models per-user in /admin view.
Specifically: I'm looking to make admin models invisible to some staff users, so that they can have a sort of customized dashboard. There's all sorts of fields that change how to present, search, query, etc. models based on whatever you want, ... |
Python module installed in site-packages folder, but getting error "No module ..." | 41,579,312 | -1 | 0 | 443 | 0 | python-3.x,module | You are getting the error because you used pip. pip basically is for version 2 of python. for using it for pip3, you should first install pip3 package. Then copy all your dependencies to python3 libraries.
Hope that answers the question. | 0 | 0 | 0 | 0 | 2017-01-10T21:44:00.000 | 1 | 1.2 | true | 41,578,978 | 1 | 0 | 1 | 1 | Using the Mac Os Terminal, I downloaded the Jupyter lightning module using "pip install lightning-python" in the /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages directory.
However, when I try to import it, I get the error, No module named 'lightning'
and when I list out the files in the si... |
pip install Django on python3.6 | 41,588,975 | 1 | 12 | 22,964 | 0 | python,django,python-3.x,pip,python-3.6 | As is common with these sort of pip issues, before you install, check where pip is pointing to with pip -V.
If that points to Python 2, you can then try pip3 -V; if that points to an older version of Python 3, go for pip3.6.
As a final approach, you can always go through python itself with python3.6 -m pip install ... | 0 | 0 | 0 | 0 | 2017-01-11T10:53:00.000 | 5 | 0.039979 | false | 41,588,925 | 1 | 0 | 1 | 2 | If I run pip install Django I get
Requirement already satisfied: Django in
/usr/local/lib/python2.7/dist-packages
I'd like to use python3.6 instead (which is already installed in /usr/bin/python3.6). What's the correct pip syntax to install the last version of Django on python 3.6? |
pip install Django on python3.6 | 41,588,953 | 4 | 12 | 22,964 | 0 | python,django,python-3.x,pip,python-3.6 | If you have pip3 then directly use
pip3 install Django
Else try to use virtualenv for your python version as :
pip -p python3.6 virtualenv name
then you can install any version of Django on it. | 0 | 0 | 0 | 0 | 2017-01-11T10:53:00.000 | 5 | 0.158649 | false | 41,588,925 | 1 | 0 | 1 | 2 | If I run pip install Django I get
Requirement already satisfied: Django in
/usr/local/lib/python2.7/dist-packages
I'd like to use python3.6 instead (which is already installed in /usr/bin/python3.6). What's the correct pip syntax to install the last version of Django on python 3.6? |
Changing Database in run time and making the changes reflect in Django in run time | 41,592,978 | 0 | 0 | 43 | 1 | python,django,django-1.10 | Django's ORM might not be the right tool for you if you need to change your schema (or db) online - the schema is defined in python modules and loaded once when Django's web server starts.
You can still use Django's templates, forms and other libraries and write your own custom DB access layer that manipulates a DB dyn... | 0 | 0 | 0 | 0 | 2017-01-11T12:32:00.000 | 1 | 0 | false | 41,591,079 | 0 | 0 | 1 | 1 | I am developing a Cloud based data analysis tool, and I am using Django(1.10) for that.
I have to add columns to the existing tables, create new tables, change data-type of columns(part of data-cleaning activity) at the run time and can't figure out a way to update/reflect those changes, in run time, in the Django mode... |
Get system time w/timezone in Django bypassing default timezone | 41,604,291 | 1 | 3 | 772 | 0 | python,django,date,datetime | Django seems to be putting its timezone in the TZ environment variable. Try del os.environ['TZ'] then using tzlocal. | 0 | 0 | 0 | 0 | 2017-01-11T13:40:00.000 | 3 | 1.2 | true | 41,592,506 | 0 | 0 | 1 | 1 | As long as I'm using plain ol' Python shell, the datetime.datetime.now() command works fine to get system's local (non-UTC) time.
But I'm working on a Django project where the time zone is changed in settings.py with TIME_ZONE = 'UTC'.
I've tried many solutions from django.utils timezone to tzlocal module, but none of ... |
Using Selenium Scripts in a Python unit test | 41,607,809 | 1 | 0 | 81 | 0 | python,unit-testing,selenium,selenium-webdriver,selenium-ide | If you are recording scripts in Python formatting, those are already converted to unit test cases. Save each scripts and run them in batch mode. | 0 | 0 | 1 | 1 | 2017-01-12T01:15:00.000 | 1 | 1.2 | true | 41,603,576 | 0 | 0 | 1 | 1 | I have recorded some Selenium Scripts using the Selenium IDE Firefox add-on.
I'd like to add these to the unit test cases for my Django project. Is it possible to somehow turn these into a Python unit test case? |
Is a separate Python instance started for each instance of a Django application via Apache? | 41,621,883 | 2 | 1 | 57 | 0 | python,django,apache | Neither of these things.
Depending on how your server is configured, it will start up multiple processes and/or threads to handle multiple requests. Each of those will handle a single request at a time; however each process stays alive at the end of a request and continues to run in order to handle subsequent requests. | 0 | 0 | 0 | 0 | 2017-01-12T19:45:00.000 | 2 | 1.2 | true | 41,621,666 | 0 | 0 | 1 | 2 | I'm a little confused as to how Apache manages separate "instances" of a Django application.
Let's say I do the following:
Go to the URL of my Django application
Open up a new browser tab
In the new tab, also go to the URL of my Django application
Are two Python instances started, one for each browser tab?
The applic... |
Is a separate Python instance started for each instance of a Django application via Apache? | 41,621,708 | 0 | 1 | 57 | 0 | python,django,apache | In the scenario you outlined there should be one instance of Django running on the server. It just happens to be managing two sessions. | 0 | 0 | 0 | 0 | 2017-01-12T19:45:00.000 | 2 | 0 | false | 41,621,666 | 0 | 0 | 1 | 2 | I'm a little confused as to how Apache manages separate "instances" of a Django application.
Let's say I do the following:
Go to the URL of my Django application
Open up a new browser tab
In the new tab, also go to the URL of my Django application
Are two Python instances started, one for each browser tab?
The applic... |
How to view source code and project directories of AWS Beanstalk application? | 41,682,747 | 9 | 3 | 2,471 | 0 | python,amazon-web-services,amazon-elastic-beanstalk | Sign into AWS Console, click Services in top left, then click Elastic Beanstalk (under Compute), then click on your application (not applicationName-env, but just ApplicationName). Next, click Application Versions on the left hand side and you'll see a list of applications. Under the Source section, you can access the ... | 0 | 0 | 0 | 0 | 2017-01-16T01:35:00.000 | 1 | 1.2 | true | 41,668,312 | 0 | 0 | 1 | 1 | I just launched an AWS beanstalk django application after going through the steps provided by AWS. I used the default settings to create the application (the default "Welcome" page for Django). Is there any way for me to download or view the source code and project directories from the AWS console, or any other locatio... |
Setting a remote control panel page for home automation | 41,681,979 | 1 | 0 | 164 | 0 | php,python,web,automation | The web site could be created in any number of languages, PHP being one good choice. The server could be local, or if you want to be able to interface globally, on a hosted server.
How your Arduino connects to the server is the most telling part. If you use a WiFi or Ethernet shield, you can have it poll the server to ... | 0 | 0 | 0 | 1 | 2017-01-16T16:35:00.000 | 1 | 1.2 | true | 41,680,964 | 0 | 0 | 1 | 1 | I have a long term project, for learning purposes, which is creating a virtual assistent, such as Siri or Google Now, but to control my home automation. I'll have an arduino controling some hardware (such lamps, sensors, etc.), and the assistent I'll write in Python. Until this step, I have the knowledge to do this.
Bu... |
Import Error on using pydoc | 56,145,781 | 2 | 4 | 6,605 | 0 | python,pydoc | When you get the import error from Pydoc, there are some steps you can find out the bug.
Step
Check the Python version of your files/packages and Pydoc are mapping. Some environment exist Python2 and Python3 at the same time. Basically, the alias pydoc is for Python 2, and pydoc3.X is for Python 3.
Check the import fi... | 0 | 0 | 0 | 0 | 2017-01-17T08:51:00.000 | 4 | 0.099668 | false | 41,692,655 | 1 | 0 | 1 | 1 | I have following files in same folder:
config.py, init.py, asc.py and mainfile.py
contents of init.py file:
from mainfile import *
config and asc files are imported in mainfile.py.
I am creating html using pydoc as:
python -m pydoc -w mainfile.py
I am getting error as:
<type 'exceptions.ImportError'>: No module n... |
Running PyDev refactor from java code? | 41,715,898 | 0 | 0 | 78 | 0 | java,python,eclipse,plugins,pydev | If you mean in an Eclipse plugin with a dependency on PyDev, then yes, it should be possible...
Take a look at the test-cases for this: com.python.pydev.refactoring.refactorer.refactorings.renamelocal.RenameClassRefactoringTest | 0 | 0 | 0 | 0 | 2017-01-17T18:34:00.000 | 1 | 1.2 | true | 41,704,515 | 1 | 0 | 1 | 1 | Is possible to call the pydev refactor (passing a new/old class name) from a Java code, such as clicking in a button in an Eclipse plugin? |
Upgrading Facebook Ads token to "Basic" | 41,785,371 | 0 | 1 | 75 | 0 | python,facebook,facebook-graph-api,facebook-ads-api | Okay, so I just ended up filling the form and when asked for instructions of how to run the demo I explained that the app wasn't "demonstrable".
And the app tier was upgraded automatically. | 0 | 0 | 0 | 0 | 2017-01-18T22:20:00.000 | 1 | 1.2 | true | 41,730,490 | 0 | 0 | 1 | 1 | I am developing an app using the Facebook Ads api. Initially it is just a Python script which downloads ads performance information from my client and stores it in a database, where it is combined with information from other sources in order to provide better reporting for them.
It is not a web app (yet). It is just a ... |
python mechanize Http error 100 | 45,281,197 | 0 | 0 | 57 | 0 | python-2.7,python-3.x | First verify if the login is being done by checking the redirected link with
print br.geturl()
If it is logging in and you're have an http error in your console use exceptions for the http error which will redirect you to your page | 0 | 0 | 0 | 0 | 2017-01-19T02:12:00.000 | 1 | 0 | false | 41,732,616 | 0 | 0 | 1 | 1 | I am having trouble logging in my Microsoft account using python mechanize utility. user-name and password are working fine. Problem comes when submitting the form, I get an interim response page with title: "continue" . and URL: some interim_URL.
Question is how do I move to my intended URL? br.open("intended_URL") d... |
Accessing templatetags globally for django project | 41,748,047 | 2 | 0 | 579 | 0 | python,django,django-templates | Template tags need to be in an app.
But once they are, they can be used by templates in any app. There is no need to do anything to make them available globally. | 0 | 0 | 0 | 0 | 2017-01-19T17:25:00.000 | 2 | 1.2 | true | 41,747,991 | 0 | 0 | 1 | 1 | I tried to add the path under INSTALLED_APPS and to create a folder of template tags and reuse them in multiple apps. But it is not working. Is there a smart way to work it out? All I need is to place templatetags for whole project in single directory accessible globally. |
HTTP POST Data from Arduino to Django Database | 41,748,434 | 0 | 1 | 1,484 | 0 | django,postgresql,python-3.x,post,arduino | 1)Depends, if your arduino is on the same local network than your Django Server then you don't need a public IP, otherwise you would have to forward your Django Server IP & port so its accesible from internet.
2) Not really, you can do a traditional POST request to a normal view on Django. | 0 | 0 | 0 | 1 | 2017-01-19T17:43:00.000 | 1 | 1.2 | true | 41,748,325 | 0 | 0 | 1 | 1 | I know it is frowned upon to post questions without code, but I have been stuck for days thinking of how to handle this issue and cant think of a solution.
My setup is this:
Arduino Mega w/ 4G + GPS Shield from Cooking Hacks
Django Server set up with Python
Postgresql Database
Because the 4G + GPS shield has the c... |
Benefits of foreign key over integerfield | 41,751,929 | 1 | 0 | 61 | 0 | python,django,database | Deleted objects
If you ever decided to delete the original post, you'd need a separate query to handle whatever you expect to do with the cloned posts instead of using the on_delete kwarg of a FK.
Its an extra query
As noted in the comments, foreign keys allow you to traverse the relationships directly through the O... | 0 | 0 | 0 | 0 | 2017-01-19T19:11:00.000 | 1 | 0.197375 | false | 41,749,825 | 0 | 0 | 1 | 1 | I'm not sure if this is an appropriate question here. I know the answer but I don't really know why, and I need proof when I raise this to my team.
We have a number of Blog Posts on a Django Site. It's possible to "clone" one of those blog posts to copy it to another site. The way the current developer did that was ... |
How to pass java literals from python dictionary | 41,764,528 | 0 | 0 | 52 | 0 | java,python,json | while passing json to java api from python replace null with None ,true with True and false with False. It will work | 0 | 0 | 1 | 0 | 2017-01-20T05:33:00.000 | 2 | 0 | false | 41,756,756 | 1 | 0 | 1 | 2 | I am trying to give rest call to java API using python.
Java API needs JSON input with java literals like {a:null,b:true,c:false},
While parsing the JSON from python it is not allowing to do so because python needs null,true and false to be inside double quotes like "null","true","false".
what is the solution? |
How to pass java literals from python dictionary | 41,756,812 | 0 | 0 | 52 | 0 | java,python,json | The JSON syntax expects values to be quoted.
It means that the problem comes from the java JSON api.
What API do you use ? | 0 | 0 | 1 | 0 | 2017-01-20T05:33:00.000 | 2 | 0 | false | 41,756,756 | 1 | 0 | 1 | 2 | I am trying to give rest call to java API using python.
Java API needs JSON input with java literals like {a:null,b:true,c:false},
While parsing the JSON from python it is not allowing to do so because python needs null,true and false to be inside double quotes like "null","true","false".
what is the solution? |
Django source code won't update on server | 57,338,131 | 0 | 1 | 666 | 0 | python,django,apache,wsgi | For those of you with cPanel, if you go under "Setup Python App" and click "Restart" it should update. Saved me about 5 times. | 0 | 0 | 0 | 0 | 2017-01-20T05:37:00.000 | 3 | 0 | false | 41,756,800 | 0 | 0 | 1 | 1 | I have a Django website running and any updates I make to the source code won't update.
(Reason I'm changing the file is because one line of code is generating an error. What's weird is I commented out this line of code that causes the error, but the code still runs and thus still causes the error. In the django.log i... |
Django select field with thousands of choices creating thousands of database queries | 41,783,265 | 0 | 3 | 530 | 0 | python,sql,django | unicode gets a field from these other models (self.foreign_key_field.field_to_print_out).
This is where the other queries are made, not from the call to unicode or checking if its a b or a c.
Had your unicode method reference only local fields this wouldn't have been an issue, but as you have noticed fields that requi... | 0 | 0 | 0 | 0 | 2017-01-21T18:54:00.000 | 1 | 1.2 | true | 41,783,198 | 0 | 0 | 1 | 1 | I have two models, model B and model C, which both extend model A.
In a form I have a model select field for model A - this obviously loads all instances of model B and C which was my intention.
So this dropdown is over 1000 'A Objects'. I am using hasattr() to determine if they're B or C, which then uses the unicode... |
Django/ Python- should I run makemigrations on a local branch, or only on master? | 41,811,454 | 0 | 1 | 655 | 0 | python,django,git,migrate,makemigrations | Running makemigrations will automatically create python files in the "migrations" folder of the app where you modified the model. These files must be versionned in git because they cannot be dissociated from your modifications of the model.
Then, when you will merge your branch, both the modification in the model and t... | 0 | 0 | 0 | 0 | 2017-01-23T16:36:00.000 | 2 | 0 | false | 41,811,185 | 0 | 0 | 1 | 1 | I am working on a project that has been written in Python/ Django, and have recently made some changes to one of the models. I want to test the changes that I have made now, before I go any further into the development of this new feature, but I am aware that I will need to run python manage.py makemigrations & python ... |
Should we store session privileges in python shelve or as session variables? | 41,957,026 | 5 | 3 | 226 | 0 | python,session,flask,shelve | I recommend take a look at NoSQL storage engines like Memcached or Redis.
They give you several advantages:
Place at a separate machine, so if you need to scale your app you'll be able to do it.
Extra interface to check what is stored in them.
Ability to flush if you really need once.
You can connect other apps to the... | 0 | 0 | 0 | 0 | 2017-01-25T07:23:00.000 | 2 | 1.2 | true | 41,845,657 | 1 | 0 | 1 | 1 | Writing a web based flask api application with several modules. I would like to incorporate different permissions and privileges for different user logins for the different modules. Query is whether these privileges should be stored as session dictionaries or as shelve values? Which is more efficient and faster? Why wo... |
How can I run a simple python script hosted in the cloud on a specific schedule? | 50,078,814 | 0 | 0 | 549 | 0 | python,amazon-web-services,heroku,cron | Update: AWS does now support Python 3.6. Just select Python 3.6 from the runtime environments when configuring. | 0 | 1 | 0 | 0 | 2017-01-25T16:49:00.000 | 3 | 0 | false | 41,857,126 | 0 | 0 | 1 | 1 | Say I have a file "main.py" and I just want it to run at 10 minute intervals, but not on my computer. The only external libraries the file uses are mysql.connector and pip requests.
Things I've tried:
PythonAnywhere - free tier is too limiting (need to connect to external DB)
AWS Lambda - Only supports up to Python 2.7... |
PDF Attachment Downloader not working with base64 Encoding | 41,858,705 | 1 | 0 | 405 | 0 | python,python-2.7,pdf,base64,imaplib | email.header.decode_header() was exactly what I needed. Thanks so much!
Added the following lines:
filename = part.get_filename()
if decode_header(filename)[0][1] is not None:
filename = str(decode_header(filename)[0][0]).decode(decode_header(filename)[0][1])
filename_zero, fileext = os.path.splitext(filename)
fi... | 0 | 0 | 0 | 0 | 2017-01-25T17:27:00.000 | 1 | 1.2 | true | 41,857,884 | 0 | 0 | 1 | 1 | I have a program that will pull file attachments into a network share. I have this working in both single part and multi-part email messages.
I have recently received a mutlipart that is showing as :
Content-Type: application/pdf
Content-Disposition: attachment; filename="=?utf-8?B?SW52b2ljZShzKS5wZGY=?="
Content-Tran... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.