[{"Question":"I have a django server running on my PC. I want to access the server through my android phone.How can I do that? I tried running \n\npython manage.py runserver 0.0.0.0:8000.\n\nAfter this, I can access server from my pc through PC's ip address, but not accessible through other device coonected to same wifi.","AnswerCount":4,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":9759,"Q_Id":42451790,"Users Score":0,"Answer":"A related issue I ran into was in relation to this error:\n\"code 400, message Bad HTTP\/0.9 request type ('\\***\\***\\***\\***\\***\\***\\***\\***\\***')\n[time stamp] You're accessing the development server over HTTPS, but it only supports HTTP\"\nJust verify that this is the reason you are not able to view also. Of course you would see this in your server messages if so.","Q_Score":4,"Tags":"android,python,django,networking","A_Id":44104349,"CreationDate":"2017-02-25T03:57:00.000","Title":"Accessing django localhost server through lan","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a django server running on my PC. I want to access the server through my android phone.How can I do that? I tried running \n\npython manage.py runserver 0.0.0.0:8000.\n\nAfter this, I can access server from my pc through PC's ip address, but not accessible through other device coonected to same wifi.","AnswerCount":4,"Available Count":2,"Score":1.0,"is_accepted":false,"ViewCount":9759,"Q_Id":42451790,"Users Score":6,"Answer":"can you try it python manage.py runserver youripadress:8000 [python manage.py runserver 192.168.0.1:8000]","Q_Score":4,"Tags":"android,python,django,networking","A_Id":42451815,"CreationDate":"2017-02-25T03:57:00.000","Title":"Accessing django localhost server through lan","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"How to fix this error?\n\nTraceback (most recent call last):\n File \"C:\/Users\/HP\/Downloads\/cv_api\/cv_api\/manage.py\", line 10, in \n execute_from_command_line(sys.argv)\nFile \"F:\\Anaconda2Installation\\lib\\site-packages\\django-1.10.5-py2.7.egg\\django\\core\\management__init__.py\", line 367, in execute_from_command_line\n utility.execute()\nFile \"F:\\Anaconda2Installation\\lib\\site-packages\\django-1.10.5-py2.7.egg\\django\\core\\management__init__.py\", line 316, in execute\n settings.INSTALLED_APPS\nFile \"F:\\Anaconda2Installation\\lib\\site-packages\\django-1.10.5-py2.7.egg\\django\\conf__init__.py\", line 53, in getattr\n self._setup(name)\nFile \"F:\\Anaconda2Installation\\lib\\site-packages\\django-1.10.5-py2.7.egg\\django\\conf__init__.py\", line 41, in _setup\n self._wrapped = Settings(settings_module)\nFile \"F:\\Anaconda2Installation\\lib\\site-packages\\django-1.10.5-py2.7.egg\\django\\conf__init__.py\", line 97, in init\n mod = importlib.import_module(self.SETTINGS_MODULE)\nFile \"F:\\Anaconda2Installation\\lib\\importlib__init__.py\", line 37, in import_module\nimport(name)\nImportError: No module named cv_api.settings","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":93,"Q_Id":42473069,"Users Score":0,"Answer":"You need to move your settings.py file to the cv_api directory.","Q_Score":1,"Tags":"python,django,opencv,django-views,django-rest-framework","A_Id":42482342,"CreationDate":"2017-02-26T19:22:00.000","Title":"How to fix Django Rest API error?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am attempting to deploy a Django project on AWS Elastic Beanstalk. One of my views makes use of Pandas to generate some data.\nI was able to get Pandas to compile properly on my EBS hosted site. I was noticing however that the browser would become \"hung\" when I tried to access any pages. I removed the view with the Pandas and the pandas import and the problem went away. However, when I add the Pandas import back, the problem recurs, leading me to believe it is a problem with Pandas. Also, if I remove the view that utilizes Pandas, but keep the \"import pandas\" statement, the problem remains. As soon as I remove \"import pandas as pd\" the problem goes away.\nWhen I SSH into the instance and run manage.py shell I can import Pandas properly and have no problems whatsoever - so I know Pandas has compiled properly. \nI checked the logs and nothing jumps out at me. Any help would be greatly appreciated!","AnswerCount":2,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":202,"Q_Id":42473383,"Users Score":2,"Answer":"I've had problems using panda w\/django on a micro aws ec2 instance because of too little memory. Upgrading the instance solved the problem for me - \nIf you are using a t2.micro for example, i might be worth upgrading to a larger instance just to see if the problem magically disappears - like it did for me.\nPerhaps not a completely satisfactory answer, but t might help you narrow down the problem.","Q_Score":2,"Tags":"python,django,pandas,amazon-web-services,amazon-elastic-beanstalk","A_Id":42474523,"CreationDate":"2017-02-26T19:49:00.000","Title":"Django Pandas AWS","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I know that superusers and regular users are both just django's User objects, but how can I write a custom user class that requires some fields for plain users and doesn't require those fields for superusers?","AnswerCount":2,"Available Count":1,"Score":0.0996679946,"is_accepted":false,"ViewCount":535,"Q_Id":42493384,"Users Score":1,"Answer":"You can have a profile class (say UserProfile) with foreign key to the user that is to be created only when user signs up using the website's registration form. That way, superuser which is created on admin site or through command line wouldn't need an extra profile instance attached to it.","Q_Score":2,"Tags":"python,django,python-2.7,django-models","A_Id":42494571,"CreationDate":"2017-02-27T18:40:00.000","Title":"In Django, is it possible for superusers to have different required fields than non-superusers?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I read a lot about the topic, but didn't find anything that sounded as satisfactory as an idea of mine, and also don't see why it would raise problems. So if you can give it a look...\nI want to change user authentication in mid-project, i.e. avoid using a custom user model, since this requires to be done before the first migration.\nCan I just modify the email field to editable=False in the django.contrib.user.models and add a modified save(), so the email is updated from the username? Or the other way round? Pro\nAnd another distict general question: Would I do such things in the venv, or can I copy the whole auth-folder as a local app?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":305,"Q_Id":42506097,"Users Score":2,"Answer":"Firstly, your title doesn't seem to have anything to do with your question; which is a good thing, because using email as a primary key is an incredibly bad idea. People change email addresses all the time, but a PK must stay constant.\nSecondly, you should absolutely not copy the contrib.auth code. Apart from anything else, this wouldn't solve your problems with the migrations, it would just make them worse. \nA much better solution would be add a pre-save signal on User, which you can do from anywhere in your project (ideally in an AppConfig ready method). And you don't need to change the model in order to make email uneditable; you should do that in the forms that use that model.","Q_Score":0,"Tags":"python,django,authentication","A_Id":42506251,"CreationDate":"2017-02-28T10:22:00.000","Title":"django user with email as pk - hack possible?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"How to remove and add completly new db.sqlite3 database to django project written in pycharm?\nI did something wrong and I need completelty new database. The 'flush' command just removes data from databse but it't dosent remove tables schema. So the question is how to get get back my databse to begin point(no data, no sql table)","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":1356,"Q_Id":42514902,"Users Score":4,"Answer":"A SQLite database is just a file. To drop the database, simply remove the file.\nWhen using SQLite, python manage.py migrate will automatically create the database if it doesn't exist.","Q_Score":1,"Tags":"python,sql,django","A_Id":42515036,"CreationDate":"2017-02-28T17:14:00.000","Title":"How to remove and add completly new db.sqlite3 to django project written in pycharm?","Data Science and Machine Learning":0,"Database and SQL":1,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am trying to start a Python 3.6 project by creating a virtualenv to keep the dependencies. I currently have both Python 2.7 and 3.6 installed on my machine, as I have been coding in 2.7 up until now and I wish to try out 3.6. I am running into a problem with the different versions of Python not detecting modules I am installing inside the virtualenv. \nFor example, I create a virtualenv with the command: virtualenv venv\nI then activate the virtualenv and install Django with the command: pip install django\nMy problems arise when I activate either Python 2.7 or 3.6 with the commands\npy -2 or py -3, neither of the interactive shells detect Django as being installed.\nDjango is only detected when I run the python command, which defaults to 2.7 when I want to use 3.6. Does anyone know a possible fix for this so I can get my virtualenv working correctly? Thanks! If it matters at all I am on a machine running Windows 7.","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":771,"Q_Id":42519094,"Users Score":0,"Answer":"The key is that pip installs things for a specific version of Python, and to a very specific location. Basically, the pip command in your virtual environment is set up specifically for the interpreter that your virtual environment is using. So even if you explicitly call another interpreter with that environment activated, it will not pick up the packages pip installed for the default interpreter.","Q_Score":0,"Tags":"python,pip,virtualenv","A_Id":42519225,"CreationDate":"2017-02-28T21:30:00.000","Title":"Virtualenv installing modules with multiple Python versions","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have changed the Odoo 10 login page title by using website builder app but it does not work on the other pages after login. After login when I access different installed apps then the page title shows Odoo with apps name like \"Products - Odoo\" or \"Customers - Odoo\".","AnswerCount":3,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":5989,"Q_Id":42526695,"Users Score":0,"Answer":"the funciton that change the tilte_part is :\n_title_changed in the js file : addons\/web\/static\/src\/js\/abstract_web_client.js\nit uses this.set('title_part', {\"zopenerp\": \"Odoo\"});\nso you can change the word odoo by something that you need. and costumize the order of the title in _title_changed to display it like what ever you want.","Q_Score":1,"Tags":"python,openerp,open-source,erp,odoo-10","A_Id":44158222,"CreationDate":"2017-03-01T08:27:00.000","Title":"How to change the title in Odoo 10?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have coded python to scrape a webpage and retrieve listing prices.\nI want to store the data and conduct a statistical analysis on the dataset. \nWould this work?\nPython -> beautifulsoup -> mySQL -> html\nData set:\n$10 , $20, $10\nI want to be able to calculate averages and then display them on the html page.","AnswerCount":3,"Available Count":3,"Score":0.0,"is_accepted":false,"ViewCount":475,"Q_Id":42527324,"Users Score":0,"Answer":"If you are using the data for normal use you can store it in sqlite db instead of mysql which has inbuilt support from python. If your site is mostly static then you can use Beautifulsoup for scraping and there are lot of python libraries like numpy for statistical analysis. If your target site has dynamically generated content then better use phantomjs or selenium driver to retrieve those contents","Q_Score":0,"Tags":"python,html,mysql,beautifulsoup","A_Id":42529552,"CreationDate":"2017-03-01T08:59:00.000","Title":"Scrape and store data for html display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have coded python to scrape a webpage and retrieve listing prices.\nI want to store the data and conduct a statistical analysis on the dataset. \nWould this work?\nPython -> beautifulsoup -> mySQL -> html\nData set:\n$10 , $20, $10\nI want to be able to calculate averages and then display them on the html page.","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":475,"Q_Id":42527324,"Users Score":1,"Answer":"You could stay in Python for the analysis (for example with Python Pandas dataframes) before storing in mySQL:\nPython -> Beautifulsoup -> pandas -> mySQL -> html","Q_Score":0,"Tags":"python,html,mysql,beautifulsoup","A_Id":42527517,"CreationDate":"2017-03-01T08:59:00.000","Title":"Scrape and store data for html display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have coded python to scrape a webpage and retrieve listing prices.\nI want to store the data and conduct a statistical analysis on the dataset. \nWould this work?\nPython -> beautifulsoup -> mySQL -> html\nData set:\n$10 , $20, $10\nI want to be able to calculate averages and then display them on the html page.","AnswerCount":3,"Available Count":3,"Score":0.0665680765,"is_accepted":false,"ViewCount":475,"Q_Id":42527324,"Users Score":1,"Answer":"Beautifulsoup is an HTML parser. You can feed it an HTML page using Python, and extract the data you need from it. Then you can post-process the data in Python, and load it into MySQL once you're ready. I'm a bit confused about the step MySQL -> HTML, since neither is a programming language (HTML is a markup language that can't talk to MySQL, and MySQL is a database management system that can't directly output HTML), but sure, displaying MySQL data in an HTML page is a trivial step.\nIt might be a good idea to separate these steps a bit better, by the way. You have some code that extracts data and loads it into a database, and you have some code that displays data from the database. Keeping these two separated might increase you code quality.","Q_Score":0,"Tags":"python,html,mysql,beautifulsoup","A_Id":42527571,"CreationDate":"2017-03-01T08:59:00.000","Title":"Scrape and store data for html display","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I noticed that Django use double under score to define a lookup in Model.objects.filter instance.\nFor example:\nRoom.objects.filter(width__lte = 10)\nHow does it work? How can I create my own function like Django and know that width__lte is actually separated for width and lower then or equal to 10.","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":2764,"Q_Id":42544689,"Users Score":2,"Answer":"Thanks to answers below I found the answer to my question:\nDjango have a const LOOKUP_SEP = '__' then using split to split the param to a key value pair","Q_Score":4,"Tags":"python,django,django-models,syntax","A_Id":42545133,"CreationDate":"2017-03-02T00:22:00.000","Title":"How does django implement double underscore in filter?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have been adding items from a txt to my database in a djago-view - with and without the @transaction.atomic-decorator, i.e. with a loop over db-writes or one db-write -- the performance difference is near infinite!^^\nNow my observation: the default delete-action in the admin panel clearly does the (inferior) loop over db-wirtes. Which takes really long for deleting 1000 entries. \nWhy is this, is there a reason, am I missing something?!\nOr should I fix this and open a pull request ;) (would be my first oss-contribution :))\nAs mentioned in the first answer, there is a confirmation step between chosing the action and the actual delete. But even after the confirmation it takes several minutes (for a few thousand entries) to delete the items, during which the database is locked, so there is no way back at that point...","AnswerCount":2,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":299,"Q_Id":42552650,"Users Score":1,"Answer":"When doing a bulk delete, neither the models delete() methods nor the eventual pre_delete and post_delete signals are invoked, so if your code relies on either of those you are in trouble. Hence the very sensible choice to loop over instances and call their delete() method individually. No need to report it as a bug (nor to submit a patch), it's actually a feature ;)","Q_Score":0,"Tags":"python,django,database","A_Id":42555104,"CreationDate":"2017-03-02T10:18:00.000","Title":"django built-in admin action delete - reason for bad performance?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"requests.exceptions.Timeout VS \nrequests.models.Response.status_code = 504 [gateway timeout]\nwhat is the actual difference between the two as both deals with saying timeout has occurred?\nLet us say Service s1 makes call to S2\nIn s1:\nrequest.post( url=s2,..., timeout=60 ) \nwhen will requests.exceptions.Timeout be raised and in what scenario 504 is received.\nCan retries be made for all of those exceptions - I believe answer for above question might give lead to this..\nThanks in advance.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":1354,"Q_Id":42558294,"Users Score":0,"Answer":"The gateway timeout means the connected server had some sort of timeout after receiving your request(i.e. you did make a connection). However, the requests timeout exception means your script never connected to the server and timed out waiting on a response from the server (i.e. you did not make a connection).","Q_Score":1,"Tags":"python,python-2.7,request,timeoutexception,http-status-code-504","A_Id":42558358,"CreationDate":"2017-03-02T14:38:00.000","Title":"python: requests.exceptions.Timeout vs requests.models.Response.status_code 504 ( gateway timeout )","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":1,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am new to Python scripting and I am currently trying to get acquainted with python scripting and DigSILENT Powerfactory. \nI have managed thus far to execute powerfactory, activate projects and execute a load flow but after my code ends, when I try to rerun it, it wont run. In order for it to run I need to close Spyder and reopen it. I believe this is related to the fact that powerfactory is still running in the background so I was wondering if there is any command that \"forces\" powerfactory to shut down after the code execution. \nAny tip would be greatly appreciated :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":826,"Q_Id":42582399,"Users Score":0,"Answer":"you could try this:\napp.PostCommand(\"exit\")","Q_Score":2,"Tags":"python-3.x,python-3.4","A_Id":55909536,"CreationDate":"2017-03-03T15:11:00.000","Title":"How can I exit powerfactory using Python in Unattended mode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am new to Python scripting and I am currently trying to get acquainted with python scripting and DigSILENT Powerfactory. \nI have managed thus far to execute powerfactory, activate projects and execute a load flow but after my code ends, when I try to rerun it, it wont run. In order for it to run I need to close Spyder and reopen it. I believe this is related to the fact that powerfactory is still running in the background so I was wondering if there is any command that \"forces\" powerfactory to shut down after the code execution. \nAny tip would be greatly appreciated :)","AnswerCount":2,"Available Count":2,"Score":0.0,"is_accepted":false,"ViewCount":826,"Q_Id":42582399,"Users Score":0,"Answer":"I had the same problem. But faster than shutdown\/reopen spyder is to restart the kernel with ctrl + .","Q_Score":2,"Tags":"python-3.x,python-3.4","A_Id":43653385,"CreationDate":"2017-03-03T15:11:00.000","Title":"How can I exit powerfactory using Python in Unattended mode?","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have a page View-Consult with 4 bootstrap tabs.\nThere are two entities retrieved from the Datastore on this page (Consult and Assessment). The consult is created first and the assessment later (by a different user).\nNote: Consults have a property called \"consult_status\" that is PENDING before the Assessment is added, and COMPLETED after. This may be useful as a condition.\nThe properties from the Consult populate the first 3 bootstrap tabs. The Assessment properties are displayed in the 4th tab.\nThere will be a period where the Assessment has not been completed and the View-Consult page will need to display a message in the 4th tab saying \"This consult is currently awaiting assessment. You will be notified by email when it is complete.\"\nHow would I create and test for this condition and render the appropriate output inside tab 4, depending if the Assessment is complete or not.\nNote also: The Consult and Assessment have the same ID, so perhaps a better condition would be to check if there exists an Assignment with the current Consult ID. If not display message \"awaiting assessment\".","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":29,"Q_Id":42597497,"Users Score":0,"Answer":"When rendering the page just check if the assessment exists by retrieving it from the Consult (I imagine you store the assessment key inside the Consult).\nThat's it","Q_Score":0,"Tags":"twitter-bootstrap,python-2.7,google-app-engine,google-cloud-datastore,app-engine-ndb","A_Id":43709266,"CreationDate":"2017-03-04T15:05:00.000","Title":"Appengine Python - How to filter tab content depending if entity has been created","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":1,"Web Development":1},{"Question":"I have a web server using NodeJS - Express and I have a Scikit-Learn (machine learning) model pickled (dumped) in the same machine.\nWhat I need is to demonstrate the model by sending\/receiving data from it to the server. I want to load the model on startup of the web server and keep \"listening\" for data inputs. When receive data, executes a prediction and send it back.\nI am relatively new to Python. From what I've seen I could use a \"Child Process\" to execute that. I also saw some modules that run Python script from Node. \nThe problem is I want to load the model once and let it be for as long as the server is on. I don't want to keep loading the model every time due to it's size. How is the best way to perform that?\nThe idea is running everything in a AWS machine.\nThank you in advance.","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":3643,"Q_Id":42610590,"Users Score":6,"Answer":"My recommendation: write a simple python web service (personally recommend flask) and deploy your ML model. Then you can easily send requests to your python web service from your node back-end. You wouldn't have a problem with the initial model loading. it is done once in the app startup, and then you're good to go\nDO NOT GO FOR SCRIPT EXECUTIONS AND CHILD PROCESSES!!! I just wrote it in bold-italic all caps so to be sure you wouldn't do that. Believe me... it potentially go very very south, with all that zombie processes upon job termination and other stuff. let's just simply say it's not the standard way to do that.\nYou need to think about multi-request handling. I think flask now has it by default\nI am just giving you general hints because your problem has been generally introduced.","Q_Score":11,"Tags":"python,node.js,scikit-learn,child-process","A_Id":62075227,"CreationDate":"2017-03-05T16:02:00.000","Title":"Sklearn Model (Python) with NodeJS (Express): how to connect both?","Data Science and Machine Learning":1,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"Good day. \nI'm a newbie to Django and I have a slight confusion:\nWhen deploying my Django app, do I need to deploy it with all the Python 'come-with' modules, or the hosts already have them installed. \nAlso, I installed PIL for image manipulation. Would they also have it installed or i have to find a way to install it on their servers. Thanks in advance","AnswerCount":1,"Available Count":1,"Score":0.1973753202,"is_accepted":false,"ViewCount":28,"Q_Id":42615538,"Users Score":1,"Answer":"do I need to deploy it with all the Python 'come-with' modules\n\nNever do that. It might conflict with the dependencies on the server. Instead issue the following command to create a dependency file (requirements.txt).\npip freeze > requirements.txt (issue this command where manage.py is located)\nOn the server create a new virtual environment. Now copy django project to the server (you can do this using git clone or just plain old Filezilla). Activate virtual environment. Then change you current working directory to the where manage.py is located. to install all the dependencies issue the following command.\npip install -r requirements.txt\nThis will install the required dependencies on on server.","Q_Score":0,"Tags":"django,python-3.x","A_Id":42618333,"CreationDate":"2017-03-05T23:56:00.000","Title":"confusion in deploying module's with django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"We have asynchronous python application (telegram bot), and we want to add localization: user selects language when he starts dialog with bot, then bot translates all messages for him.\nDjango allows to change language for every request, it is working normally, because Django create separate process for each request. But it will not work in async bot \u2014 there is only one process and we should handle multiple users with different languages inside of it.\nWe can do simple thing \u2014 store user's preferences in Database, load the preferred language from DB with each incoming message, and them pass this settings to all inside functions \u2014 but it is quite complicated, because our bot is complex and there can be more than dozen included function calls.\nHow we can implement language switching in the asynchronous application with elegant way?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":703,"Q_Id":42619597,"Users Score":0,"Answer":"Okay, we solved problem using with that provide us with context to all inner function calls.","Q_Score":2,"Tags":"python,asynchronous,localization,internationalization,gettext","A_Id":42623529,"CreationDate":"2017-03-06T07:13:00.000","Title":"Localization for Async Python Telegram bot","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":1,"Python Basics and Environment":1,"System Administration and DevOps":0,"Web Development":1},{"Question":"Basically, I would like to deploy a web2py application with a set of default users already registered\/created in the application. \nCan this be accomplished by importing a CSV file containing default username\/password and other details into the auth_user table? \nAny help is welcome.\nThanks.","AnswerCount":1,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":183,"Q_Id":42620942,"Users Score":0,"Answer":"If you want to do it manually, just:\n\ngo to your application admin interface\nclick on the \"database admin\" button (mighy be translated to your OS language)\nclick on db.auth_user\nthen use the Import\/Export feature form at the bottom of the page\n\nThat's it.","Q_Score":0,"Tags":"python,web2py","A_Id":42701682,"CreationDate":"2017-03-06T08:36:00.000","Title":"Creating default set of username\/password from a csv file in a web2py application","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I am getting CSRF verification failed when i return to back go back after login using django method.\nIt returns the sign in page even after i successfully log in. And it posts the error as CSRF verification failed.\nCould I use to set anything in Django setting?","AnswerCount":2,"Available Count":1,"Score":0.0,"is_accepted":false,"ViewCount":528,"Q_Id":42625724,"Users Score":0,"Answer":"The CSRF token is rotated after the user logs in. If the user goes back in their browser after logging in and submits a form with the old token, then you will get a CSRF error.\nIf you refresh the page with the form after logging in, then the page will be reloaded with the new token, and CSRF verification should pass.","Q_Score":1,"Tags":"python,django","A_Id":42626309,"CreationDate":"2017-03-06T12:30:00.000","Title":"Django - CSRF verification failed - after successfully logged in","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"I have multiple python apps that are gathering and doing manipulation with data. \nAt this moment I use pewee as a database, but I am considering integrating them with Django, mostly because of the Django admin (more easy to manually check\/modify data for me and non-devs) instead of building an interface myself.\nThe external apps run independently one of another and do a lot of database operations. They are gathering data from online and offline(excel, csv) sources, and do not run on a server(can be considered desktop apps).\nIt is possible to start an app from Django admin, by adding a button ?\nWhat is the best way to add them from a project organization point of view ?","AnswerCount":1,"Available Count":1,"Score":1.2,"is_accepted":true,"ViewCount":68,"Q_Id":42650548,"Users Score":1,"Answer":"Add the app name into installed_apps in Django settings file. Then you can use all the features of the app in django.","Q_Score":1,"Tags":"python,django,python-3.x","A_Id":42651965,"CreationDate":"2017-03-07T14:13:00.000","Title":"Integrating other python apps in Django","Data Science and Machine Learning":0,"Database and SQL":0,"GUI and Desktop Applications":0,"Networking and APIs":0,"Other":0,"Python Basics and Environment":0,"System Administration and DevOps":0,"Web Development":1},{"Question":"What does the mytubeid tag(like