Jump to content

heirloom

Members
  • Posts

    20
  • Joined

heirloom's Achievements

Newbie

Newbie (1/14)

  • Conversation Starter Rare
  • Week One Done Rare
  • One Month Later Rare
  • One Year In Rare

Recent Badges

0

Reputation

  1. I'm not capable of uploading a website without SSH and I'm not planning on donating until I have the website up and running without problem for at least a month. What can I do?
  2. Hello, my account has been archived even though I logged into it this month: The last time you logged in was 2020-12-01 Please unarchive it Username: heirloom
  3. Nice, it's good to know that I can run flask from the web root. That's not what I'm asking though. I want to keep flask in the subdirectory. But the routes of my app don't take into account that subdirectory so I need a way to append '/flask/' to all routes without actually having to change them one by one in the code.
  4. With my current configuration apache won't read the .htaccess file in the folder /home/username/public_html/flask. First I have to setup apache to read from that folder. How do I do that?
  5. I have an app with static paths like this: import sys import platform from flask import Flask, __version__ app = Flask(__name__) @app.route("/") def hello(): return """ Hello World!<br><br> <a href="/info/">System Information</a> """ @app.route("/info/") def info(): return f""" Platform: {platform.platform()}<br> Python version {sys.version}<br> Flask version: {__version__} """ if __name__ == "__main__": app.run()But when I use it in heliohost the links have to be prefixed with '/flask/'. Is there a way to do this without having to change all the links in the application?
  6. How do I set up the public_html/flask folder?
  7. In the WSGIScriptAlias the alias should be '/' or else all links inside the application will have to include '/flask/path' and changing all the links in the application is not easy unless you've made them relative to a specific url that you can easily change. This has be done for heliohost anyway. This problem has an answer in Path configuration problem with mod_wsgi - WSGIScriptAlias The way in which the Tommy server is configured is probably using the technique explained there.
  8. Actually the installed mod_wsgi was using Python 2.7. So I need a way to install the correct version of mod_wsgi. After installing the correct version of mod_wsgi I no longer have to include the location of the packages. mod_wsgi is now using the default Python3 which is 3.6.8. I couldn't get it to run with 3.7.4, even when installing it with --enable-shared it gave 'Error while loading shared libraries' unless I specified the location of the packages in the code like: import site site.addsitedir('/usr/local/lib/python3.7/site-packages') site.addsitedir('/usr/local/lib64/python3.7/site-packages')Install mod_wsgi 4.6.7 with python 3.7.4 in CentOs 7
  9. I've had some trouble configuring the 'flask' folder. I don't know why I've had to include the location of the python packages in the wsgi file. Or else it said: Exception occurred processing WSGI script '/var/www/flask/myapp.wsgi'. Traceback (most recent call last): File "/var/www/flask/myapp.wsgi", line 6, in <module> from myapp import app as application File "/var/www/flask/myapp/__init__.py", line 1, in <module> from flask import Flask ImportError: No module named flaskAlso although I've installed python 3.7.4 I had to end up using the default Python 3, which is 3.6.8, because I didn't know how to use pip without installing the default. And I couldn't install mod_wsgi from source because it gave me an error, that was something like: 'apxs command not found'. Probably I forgot some dependency. Here I write all the commands I used to deploy flask apps with apache in centos in a similar way as how the Tommy server does it: # VirtualBox guest additions sudo yum install -y epel-release centos-release-scl sudo yum update -y sudo yum install -y make gcc kernel-headers kernel-devel perl dkms bzip2 # Devices -> Insert Guest Additions CD image and run it sudo reboot sudo yum install -y dconf-editor bash <(curl -s https://raw.githubusercontent.com/ajr-dev/post-install-script/master/install/settings/gnome.sh) # Install apache sudo yum install -y httpd httpd-devel python3 python3-pip python3-devel sudo systemctl start httpd sudo systemctl enable httpd # Install mod_wsgi 4.6.7 wget -q "https://github.com/GrahamDumpleton/mod_wsgi/archive/4.6.7.tar.gz" tar -xzf '4.6.7.tar.gz' rm '4.6.7.tar.gz' cd 'mod_wsgi-4.6.7' ./configure --with-python=/usr/local/bin/python3 make sudo make install # Add this to `/etc/httpd/conf/httpd.conf` # LoadModule wsgi_module modules/mod_wsgi.so apachectl restart sudo cat /var/log/httpd/error_log # If all is okay, you should see a line of the form: # Apache/2.4.6 (CentOS) mod_wsgi/4.6.7 Python/3.6 configured cd .. sudo rm -rf 'mod_wsgi-4.6.7' apachectl restart # Flask Deploy with Apache on CentOS sudo pip3 install flask==1.1.1 cd /var/www sudo mkdir flask cd flask sudo mkdir website sudo vi __init__.py from flask import Flask app = Flask(__name__) sudo vi main.py import sys import platform from website import app def linux_distribution(): try: return platform.linux_distribution() except: return "N/A" @app.route("/") def hello(): return """ Hello World!<br><br> <a href="/flask/info/">System Information</a><br> """ @app.route("/info/") def info(): return f""" Python version: {sys.version}<br> dist: {platform.dist()}<br> linux_distribution: {linux_distribution()}<br> system: {platform.system()}<br> machine: {platform.machine()}<br> platform: {platform.platform()}<br> uname: {platform.uname()}<br> """" if __name__ == "__main__": app.run(debug=True)sudo vi website.wsgi import sys sys.path.insert(0, '/var/www/flask') from website import main, app as applicationcd /etc/httpd/conf/ sudo cp httpd.conf httpd.conf.bak sudo vi httpd.conf Insert: <VirtualHost *:80> ServerName localhost WSGIScriptAlias /flask /var/www/flask/website.wsgi <Directory /var/www/flask> Require all granted </Directory> </VirtualHost>apachectl restart # Get IP hostname -I # When visiting 'http://my_host_ip/flask' you should see 'Hello World!' # If you are getting an error you can see it by doing sudo cat /var/log/httpd/error_log
  10. I'm having trouble debugging the code from a github repository that works on my machine, but I can't make it work on the server. So I would like to make a virtual machine with the same os and applications to be able to debug the code. I'm doing a flask website. What are the applications that Tommy has installed to deal with flask? Which os? How to install wsgi?
  11. Nevermind I see that I already imported the modules when I imported the code. That's not the case with Node.js. @filmegoo: You need to download the modules locally using NPM and then compress the node_modules folder to a zip file and upload it to your Node.js folder. After that, extract the file.
  12. It did install the python packages but it failed to install the node modules. Is npm installed in Tommy? Here is the output: 20200727124103-cron.log
  13. I just want to check a script I want to run to make sure it's ok. I want to cd to the flask folder and then run 'python3 dev.py build' so the script that I've made is: `cronjob1.sh` in `$HOME/cronjobs` folder with execute permissions. #!/bin/bash cd "$HOME/public_html/flask/" /usr/bin/python3.7 dev.py build And then the cronjob would be: $HOME/cronjobs/cronjob1.sh > $HOME/logs/`date +\%Y\%m\%d\%H\%M\%S`-cron.log 2>&1dev.py will install pip requirements and npm modules for the project that I've uploaded to work. You think it's ok like that?
  14. That was it, I could register with the same email as in the forum. Thanks a lot!
  15. Yesterday I tried signing up in a server and when in the password selection page it didn't let me press next to finish. It happened in Tommy, Ricky and Johnny. I used the same username, domain and password for all three: name: heirloom domain: heirloom.heliohost.org I didn't receive any error so I don't know what the problem might be. Thank you.
×
×
  • Create New...