pythonanywhere / help_pages Goto Github PK
View Code? Open in Web Editor NEWThe help pages for help.pythonanywhere.com
The help pages for help.pythonanywhere.com
Hello there,
Can u please add this site to whitelist server...
https://www.mohfw.gov.in/
its government site and have Important covid Data I need. in my project.
I am not able to install PyAudio library how can I install
https://github.com/pythonanywhere/help_pages/blob/master/articles/EnvironmentVariables.md
mentions how to load environment variables in your web application or in your virtualenv consoles.
However, not everyone uses a virtualenv and there is no documentation to address loading the environment variables into a normal bash console.
I discovered you just need to add set -a; source ~/my-project-dir/.env; set +a
to the .bashrc
file that's at /home/username/ so it shouldn't be hard.
I think this would make the article more complete, I could open a PR if you want but I wanted to run this past you guys first :)
paste.ee links not working
I am trying to access the Relational DB from PythonAnywhere Application but it does not allow me to connect to the database.
I get the error: connection to server at "vmd.h.filess.io" (161.97.121.243), port 5433 failed: Connection refused
After researching a lot, I found that the website/server is not listed in the Allowlisted sites for free users and because of that, I cannot connect to the DB.
Please add vmd.h.filess.io to the allowed hosts list.
on this page: https://help.pythonanywhere.com/pages/AccessingMySQLFromOutsidePythonAnywhere/
add the following line to: MySQL Workbench section right above Settings Values
select "Standard TCP/IP over SSH" from drop down combo box
spent 2 hours trying "Standard TCP/IP" and setting the SSH values on the Remote Management Tab in the Sql Workbench UI but i would get unable to connect to localhost errors but if you use the "Standard TCP/IP over SSH" it works just fine.
by the way i think pythonanywhere is really awesome. you guys have done a fantastic job.
An alternative to 'print browser.title'
Hello,
Can you add AstraDB to the whitelist api? it's usually used to store document and query data from cassandra DB using a REST api, the url is something like:
More about AstraDB at: https://docs.datastax.com/en/astra/docs/retrieving-rows-from-your-table.html
On your site's help page How can I use a different version of Python for the Save & Run button?, the Python versions which references both within the text (3.7 and 3.6) and also within the second code example (3.4 and 3.3) appear to have drifted apart over time.
Hi there,
I was trying to give custom domain to my deployed application. So I was looking in the help pages - this shows that I can click on the pencil to set my domain, but in my case it is not coming or it is removed.
Change the mysql import with pymysql on the following article
https://help.pythonanywhere.com/pages/AccessingMySQLFromOutsidePythonAnywhere
Section From Python code
Some users (me included) have been experiencing errors DB frozen errors while trying access the DB via SSH Tunnel using that code.
Articles with Examples on this Topic
My working example after changing that:
import pymysql as sqlConnector
import sshtunnel
sshtunnel.SSH_TIMEOUT = 5.0
sshtunnel.TUNNEL_TIMEOUT = 5.0
dbHostName='zzzzzz.mysql.pythonanywhere-services.com'
dbName='myDB$tendlc_db'
dbUserName='myDBuser'
dbUserPassword='xxxxxx!'
sshHostName='ssh.pythonanywhere.com'
pyUserName='myLogin'
pyPassWord='myPWD'
#Perform Connection test and Sample Query
def dbtest():
dbapi_config.refresh()
with sshtunnel.SSHTunnelForwarder(
(sshHostName),
ssh_username=pyUserName, ssh_password=pyPassWord,
remote_bind_address=(dbHostName, 3306)
) as tunnel:
print ("SSH TUNNEL ESTABLISHED")
connection = sqlConnector.connect(
user=dbUserName, password=dbUserPassword,
host='127.0.0.1', port=tunnel.local_bind_port,
database=dbName,
)
print("CONNECTED")
tst_query="SHOW TABLES"
execute_query(conn=connection,query=tst_query)
connection.close()
#This Helper function o execute query I am not the author but someone else's I cant find on my files
def execute_query(conn, query):
cur = conn.cursor()
cur.execute(query)
print(cur.description)
print()
for row in cur:
print(row)
I tried to install and use FastAPI with unicron package using all possible ways to install and use Unicorn package, it does install but wont run Unicorn, and fails with error. As various environments with » Django » web2py » Flask » Bottle are available. FastAPI is the most advanced and popular framework for Python web async development.
Whenever I try to create a virtual environment using mkvirtualenv
or virtualenv
commands, the setup gets stuck and no further progress happens. Hitting ctrl_c
gives the result as:
10:12 ~ $ virtualenv -p python3 arham
Running virtualenv with interpreter /home/anujdhongade/.local/bin/python3
Using base prefix '/usr'
New python executable in /home/anujdhongade/arham/bin/python3
Also creating executable in /home/anujdhongade/arham/bin/python
Installing setuptools, pip, wheel...^Cdone.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2328, in
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 671, in main
raise SystemExit(popen.wait())
File "/usr/lib/python2.7/subprocess.py", line 1376, in wait
main()
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 713, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 945, in create_environment
download=download,
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 901, in install_wheel
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/usr/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
return func(*args)
KeyboardInterrupt
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 769, in call_subprocess
line = stdout.readline()
KeyboardInterrupt
Please help!
Greetings!
On the console, the surrounding banner blocks the text entered and the console seemingly overlaps text so I can't make out what I am typing or any errors or such thrown back, see screenshot:
I saw that you are using the workon
command in here.
Are you assuming that virtualenvwrapper
is installed along with virtualenv
?
Perhaps that could be clarified in there..
@gpjt just noticed that the link below this header is broken:
https://github.com/pythonanywhere/help_pages/blob/master/articles/403ForbiddenError.md#requesting-an-addition-to-the-whitelist
may want to fix it while your at it :)
There is currently no instructions on how to deleting/removing pythonanywhere account.
There should be an option for this and if there is it needs to be documented better.
I am getting this error for everything I do I can log in but cant continue from here
`Server Error :-/
An error has occurred. This shouldn't happen
Feel free to contact your nearest PythonAnywhere representative (there's a "Send feedback" link above), and loudly complain about the problem.
(Extra credit if you do so in rhyming verse!)`
i have a python script which takes a webhook request from dialogflow and returns a response
now here am facing trouble with importing pyowm package the error exactly says permission denied
This was a big that took me HOURS to figure out. I think it would be useful to add an article in the help pages about the following:
I was creating a flask app, and I was using bcrypt to validate my users passwords. My code worked on my local machine fine, passed all my unit tests, yada-yada. I pulled my code onto Python Anywhere, and opened a python3 shell and did this:
$ python3
>>> import bcrypt
>>>
Everything worked, so I guess that PA has it preinstalled. Let me now run my unit tests:
TypeError: Unicode-objects must be encoded before hashing
Hm, probably a Python 2 vs 3unicode thing. No worries, I'll just install the Python 3 version of bcrypt.
pip3 install --user bcrypt
Then, I run my unit tests again. Everything passes, looking good. However, I try going on my website, but all I get now is a 500 error with this in my error log:
ValueError: Invalid salt
After spending a VERY long time messing around with utf encodings, strings and even Flask-bcrypt (not python 3 friendly), I still couldn't figure anything out. Turns out, if you do a pip freeze, PA has py-bcrypt preinstalled, instead of bcrypt.
The really frustrating part is that the module to use py-bcryt is actually called bcrypt! This explains why my unit tests worked, as they were using the bcrypt module, whereas the WSGI was probably using the py-bcrypt module. After hours of googling and debugging... Finally! A solution!
So, here's what to do if you're using bcrypt in your program and you're going to host your code on Python Anywhere:
Use virtualenvs
Refactor your code so that it works with py-bcrypt. Here are the major differences I could find (bcrypt vs py-bcryt)
>>> hash.encode('utf-8') == bcrypt.hashpw(b"badpassword", hash.encode('utf-8'))
>>> True
In py-bcrypt you must only use strings:
>>> hash = bcrypt.hashpw("badpassword", bcrypt.gensalt())
>>> hash == bcrypt.hashpw("badpassword", hash)
>>> True
$2b$
, whereas py-bcrypt hashes start with $2a
. You will need to change your hashes in order for the program to work, though I'm not entirely sure if simply changing the prefix will make your hashes compatible.BTW I posted a bunch of extra details for the lone Googler who also has this obscure problem.
Could we please add the date the help page was last updated ? Preferably around the top.
I returned to renew my SSL cert only to find that https://help.pythonanywhere.com/pages/LetsEncrypt/ was updated.
It helps me as a developer to know when these updates took place.
The Django Tutorial brings you to an error when followed exactly. I've tried this with both python 2.7 and 3.5.
DjangoTutorial
The point that I'm stuck at is
python ./manage.py syncdb
Error that's given is:
23:52 ~/mysite $ python ./manage.py syncdb
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named myapp.apps
Here's some more from the error log
full error log.txt
It would like to be redirected to the main page after login in the registration window.
It was like being redirected to the previous page.
https://help.pythonanywhere.com/pages/InstallingNewModules/
Says 'Do let us know if there are any packages you think should be part of our standard "batteries included".'
I do know not know where I can you let know. If there a info on this, happy to do a PR.
May need to also python -m ipykernel install --user
Not able to figure out how to use it
https://chain.so/api
it has complete api documentation .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.