pythonanywhere

File not found on pythonanywhere.com

一个人想着一个人 提交于 2019-12-25 04:45:19
问题 On pythonanywhere.com I have a django app. This is views.py : def literature(request): module_dir = os.path.dirname(__file__) file_path = os.path.join(module_dir, 'literature.csv') with open(file_path, 'r') as f: ... File literature.csv is located at the same directory as views.py. But every time when I try to load the page I get FileNotFoundError . The same construction works normally on local server. Where is the bug? 回答1: This os.path.dirname(__file__) is giving you a relative path. On

IOError: Error reading file: failed to load HTTP resource, LXML error in Pythonanywhere

Deadly 提交于 2019-12-25 03:19:11
问题 I am having a problem using lxml with python 2.7. I tried installing lxml version 3.4.0 and 3.4.2 but got the same error no idea why tho. Here is my python code: @app.route("/getInformation", methods=['GET']) def domain(): urlList = [] urlList.append("http://gbgfotboll.se/serier/?scr=table&ftid=57109") urlList.append("http://gbgfotboll.se/serier/?scr=table&ftid=57108") date = '2015-04-18' # use this in real mode: currentDate = (time.strftime("%Y-%m-%d")) homeScore = "0" awayScore = "0"

How to add SUPER priviledge to MySQL in pythonanywhere?

送分小仙女□ 提交于 2019-12-24 20:02:55
问题 I am using PythonAnywhere to host my web application for testing purpose. My frontend and python script is working fine. Now I want to connect it to MySQL database. I have uploaded my .sql file to the mysite folder and trying to restore it using this syntax: mysql -u username -h username.mysql.pythonanywhere-services.com 'username$scm' < ab.sql as told in Backing up (and restoring) MySQL databases (where username=created username) but it's throwing this error: ERROR 1419 (HY000) at line 88:

django. Templates working local but not on pythonanywhere.com

喜你入骨 提交于 2019-12-24 11:03:08
问题 I have a working project in django when I run it local but not when I run it on pythonanywhere.com. I get error TemplateDoesNotExist. How do I make it run on pythonanywhere.com? Do i have to do something in the code or in pythonanywhere web app settings? Thanks! My code: settings.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DEBUG = True TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['templates'], 'APP_DIRS': True,

Flask app on pythonanywhere, python JSON decode error

℡╲_俬逩灬. 提交于 2019-12-24 08:47:24
问题 I'm trying to replicate my app the runs on localhost, but on pythonanywhere. I have a very basic API that provides a JSON response and it all works as expected on localhost:5000. Moving the code to pythonanywhere, i get a 500 Internal Server Error The route is: @app.route('/api/get_authors', methods = ['GET']) def get_authors(): authors = get_poi_authors() return jsonify(authors) And the problem seems to come from a line in my getPoiAuthors code: poiData = json.loads(getResult)['pois'] This

pythonanywhere - How do I use websockets to transmit messages as per the web2py messaging example?

拜拜、爱过 提交于 2019-12-24 04:58:29
问题 So I've built out an app to test websockets with web2py and pythonanywhere and I got it to work locally but when uploading to pythonanywhere it doesn't work. I think the reason is that I'm sending things to localhost (127.0.0.1) but have no idea where I need to send things (and listen to) when uploading. the debug.py script is: def listen(): script=SCRIPT(''' jQuery(document).ready(function(){ var callback=function(e){$("#test_div").html(e.data)}; if(!web2py_websocket('ws://127.0.0.1:8880

git push authentication fails

人盡茶涼 提交于 2019-12-22 11:21:55
问题 I am trying to push edits from within my pythonanywhere [hosting] account to the origin master at GitHub and fail. It asks for my GitHub username and password. And it shows the following error, despite providing the correct credentials: remote: Anonymous access to akhyansh13/simplifier.git denied. fatal: Authentication failed for 'https://www.github.com/akhyansh13/simplifier.git/' How do I push? 回答1: I would recommend setting up public key authentication. Open a Bash console and then use: ssh

Pythonanywhere install and import new module

吃可爱长大的小学妹 提交于 2019-12-22 06:57:25
问题 I'm new to Pythonanywhere and want to install the 'soundcloud' Python module. I've opened up a Bash console and given the pip install --user soundcloud command. It appears to have installed, as I see it in the list of modules when I used pip freeze in the Bash console. However, when I open up a Python 2.7 console and try import soundcloud , I get an error message saying that the Soundcloud module does not exist. Any ideas on why this is happening? 回答1: You've installed soundcloud for 2.6, but

SocketException: OS Error: Connection refused, errno = 111 in flutter using django backend

怎甘沉沦 提交于 2019-12-20 07:28:39
问题 I m building a flutter app with django rest-framework. The registration api is working fine in Postman but after some successful registration from the flutter app it is showing the above error. The request is been sent on https address. Removed csrf. Nothing happens. Request: var data = {'email':signupemailidcontroller.text, 'password1':passwordcontroller.text, 'password2':confirmpasswordcontroller.text, }; //http request here await http.post(websitesignupurl, headers: headers, body: json

Flask post data to table using SQLAlchemy/Mysql [closed]

五迷三道 提交于 2019-12-13 21:26:23
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I am trying to write data to a MySQL table from a html form, using Flask/Python/SQLAlchemy on Pythonanywhere. Mysql table is setup, I can enter data on the /transactions, but then it crashes... Mysql: mysql> DESCRIBE transactions1; +----------------+---------------+------+-----+---------+----------------+ |