lucasvda Posted February 13, 2023 Posted February 13, 2023 Is there a way to install and use Flask Extensions to access a PostgreSQL database (peewee, sqlalchemy)?
wolstech Posted February 14, 2023 Posted February 14, 2023 Krydos can answer this. If they work like other Python modules, we can install them for you. 1
Kairion Posted February 14, 2023 Posted February 14, 2023 Hello, @lucasvda. I did some research, and apparently, they can be installed using the `pip` command, the one used to install Python packages. Therefore, it should be alright to request their installation as you would with any other Python modules: You can post in the Customer Support section here or send a message in our Discord #support channel saying which packages you would like to be installed. Though I'd recommend you carefully check the packages that you may request: flask-peewee does not seem to be specifically made for working with databases and is in maintenance-only mode, according to its site. Between it and Flask-SQLAlchemy, the latter seems a better choice. Please let us know if you have any other questions or need further assistance. 1
lucasvda Posted February 14, 2023 Author Posted February 14, 2023 4 hours ago, Kairion said: I did some research, and apparently, they can be installed using the `pip` command, the one used to install Python packages. Therefore, it should be alright to request their installation as you would with any other Python modules: You can post in the Customer Support section here or send a message in our Discord #support channel saying which packages you would like to be installed. Though I'd recommend you carefully check the packages that you may request: flask-peewee does not seem to be specifically made for working with databases and is in maintenance-only mode, according to its site. Between it and Flask-SQLAlchemy, the latter seems a better choice. Thanks for the answer. I'm still developing, as soon as my flask app goes in production, I'll come back with my request to install Python packages and Flask extensions for testing a first version on the site. I'll make a requirements.txt file to list all the needed packages. I prefer working with peewee (not Flask-peewee extension). Maybe a stupid question: how can I see on my web site which packages are now installed? Or is this a server side setting?
Krydos Posted February 14, 2023 Posted February 14, 2023 We're planning on adding a Python section to the dashboard where you can see currently installed modules and request more, but for now here's the list for Python 3.10 on Johnny. Also if you try to load a module that's not installed you will get a 500 error and you can check your error log and it will say which module isn't installed. aiohttp==3.8.3 aiosignal==1.3.1 appdirs==1.4.4 asgiref==3.6.0 async-timeout==4.0.2 attrs==22.2.0 beautifulsoup4==4.11.2 certifi==2022.12.7 charset-normalizer==2.1.1 click==8.1.3 clikit==0.6.2 cmdstanpy==1.1.0 commonmark==0.9.1 contourpy==1.0.7 convertdate==2.4.0 crashtest==0.3.1 cryptocmd==0.6.1 cycler==0.11.0 Deprecated==1.2.13 discord==2.1.0 discord.py==2.1.0 Django==4.1.5 django-bootstrap-modal-forms==2.2.0 django-nested-admin==4.0.2 ephem==4.1.4 Flask==2.2.2 Flask-Limiter==3.1.0 fonttools==4.38.0 frozenlist==1.3.3 gunicorn==20.1.0 hijri-converter==2.2.4 holidays==0.19 httpstan==4.9.1 idna==3.4 itsdangerous==2.1.2 Jinja2==3.1.2 joblib==1.2.0 kiwisolver==1.4.4 korean-lunar-calendar==0.3.1 limits==3.2.0 LunarCalendar==0.0.9 lxml==4.9.2 MarkupSafe==2.1.1 marshmallow==3.19.0 matplotlib==3.6.3 multidict==6.0.4 numpy==1.24.2 ordered-set==4.1.0 packaging==23.0 pandas==1.1.4 pastel==0.2.1 paytmchecksum==1.7.0 Pillow==9.4.0 plotly==5.13.0 prophet==1.1.2 psycopg2-binary==2.9.5 pycryptodome==3.16.0 Pygments==2.14.0 pylev==1.4.0 PyMeeus==0.5.12 pyparsing==3.0.9 pysimdjson==5.0.2 pystan==3.6.0 python-dateutil==2.8.2 python-dotenv==0.21.0 python-monkey-business==1.0.0 pytz==2018.5 requests==2.28.2 rich==12.6.0 scikit-learn==1.2.1 scipy==1.10.0 six==1.16.0 soupsieve==2.3.2.post1 sqlparse==0.4.3 tablib==3.3.0 tenacity==8.2.1 threadpoolctl==3.1.0 tqdm==4.64.1 typing_extensions==4.4.0 tzdata==2022.7 urllib3==1.26.14 webargs==8.2.0 Werkzeug==2.2.2 whitenoise==6.3.0 wrapt==1.14.1 yarl==1.8.2
lucasvda Posted February 18, 2023 Author Posted February 18, 2023 Testing the psycopg2 module to access a Postgresql databases I came into this problem: I really don't know much about cached web pages, but old versions of my flask scripts during recent testing stayed too long in the cache I think. Even changing filenames, route names in the script, doesn't help. The new page or route isn't reachable. I still see the old versions... But with my PHP script on the site I have no problems. Every call to the script gives me new information, no cached information. Only with the Python scripts I still see older versions and so there is no dynamic web page that works really well. Question: can you give me external access to my Postgresql database? Tx in advance for the support
Krydos Posted February 18, 2023 Posted February 18, 2023 37 minutes ago, lucasvda said: The new page or route isn't reachable. I still see the old versions... Correct, WSGI uses server side caching, like it says in our guide. On 10/1/2022 at 3:28 AM, Krydos said: *** Please note that since wsgi uses server side caching your changes might not appear immediately, and in some cases might take several hours to update. We recommend developing your Flask app on your home computer and hosting the production copy on the server. That means that Flask and Django apps can use the same old code for up to 2 hours. To make matters even worse different Apache processes can have different versions of your code cached so refreshing the page over and over may result in randomly picked versions of your site from the last 2 hours. This is why we recommend developing your Flask and Django apps on your development computer, and then uploading the production version to be hosted on our server. Note that Python CGI doesn't have caching like that, just Flask and Django. 38 minutes ago, lucasvda said: can you give me external access to my Postgresql database? Remote access has been enabled to your only PotgreSQL database from your only PostgreSQL user. 1
Krydos Posted February 18, 2023 Posted February 18, 2023 I also should mention that Flask and Django apps on our VPS plans don't use caching like that and your changes will show up immediately. VPS plans start at $4 per month and you can signup at https://heliohost.org/vps/
Recommended Posts