This series will try to explore how you can deploy your python code written with web2py serving on Apache on a debian system. Debian is a fantastic and fast mother OS that is my personal favourite. The forks like Ubuntu are great but I instead prefer debian. It is stable, it is tough to break in, flexible and has tons and tons of packages. If you want to deploy your code for any other python web framework, I request you to follow the series. It has something for everyone. Python never ceases to amaze me, I am a fan of this language and have been working since the last 12 plus years on it. At the end of this series I would share a pdf more like a scratch book with all of you readers that has my notes.
Currently I am using python 3.9.x as my go to development environment. However when I deployed my three production projects on websites, I was using python 2.7.13. This guide is based on that. With that said, if you have all the packages for your python 3.x project this will certainly work for you.
Configuring python, web2py on vps server
- Install sudo if not already done –
- apt-get install sudo
- Install python if not already installed by default it has 2.7.13
- apt-get install python2
- sudo apt-get install python3 python3-pip for python 3
- use apt-get upgrade <<packagename>> to upgrade anything
- Install pip using get pip script
- Then use pip to install python packages
- pip install <pagkagename>
- pip install reportlab
- pip install pygal
- pip install razorpay
- pip install exifread (for artpic)
- pip install pg8000 (for web2py dependency, found in artpic)
Debian packages required
Make sure your sources.list file is configured properly to let you install packages from the internet [/etc/apt/sources.list]
Below is an example of a sources.list for Debian 9/Stretch.
deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security/ stretch/updates main
deb-src http://security.debian.org/debian-security/ stretch/updates main
deb http://deb.debian.org/debian stretch-updates main
deb-src http://deb.debian.org/debian stretch-updates main
If you also want the contrib and non-free components, add contrib non-free after main:
deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free
deb http://security.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security/ stretch/updates main contrib non-free
deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free
For resolving errors use – If sudo is not available login using su , password
sudo apt-get clean
or,
sudo apt-get autoclean
sudo apt-get -u dist-upgrade
sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install package-name
Debian system update and upgrade
Issue below commands periodically to upgrade and update your debian server. This is necessary so that you receive all the critical security fixes and package updates every month.
Run:
apt-get update
To update the apt package database
apt-get upgrade
and to install the latest updates (if there are any).
In case of errors use commands specified above on page5
There are two parts to your question:
- fixing temporary resolve messages
- fixing the package management issues
Temporary resolve
It is likely that this issue is either:
- temporary due to your Internet Service Provider not correctly forwarding internet naming (DNS) to either its or external DNS servers, or
- due to a change in your network has similarly blocked this naming – for example, new router/modem, reconfiguring a switch with a new configuration.
Lets look at the possible DNS resolving issues.
First, temporarily add a known DNS server to your system.
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Then run sudo apt-get update
.
If this fixes your temporary resolving messages then either wait for 24 hours to see if your ISP fixes the issue for you (or just contact your ISP) – or you can permanently add a DNS server to your system:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
8.8.8.8
is Google’s own DNS server.
Another example DNS server you could use is OpenDNS – for example:
echo "nameserver 208.67.222.222" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
To reboot or restart debian system
To shut down the system from a terminal session, sign in or “su” to the “root” account. Then type “/sbin/shutdown -r now”. It may take several moments for all processes to be terminated, and then Linux will shut down. The computer will reboot itself.
>> Init 6 [Enter] also works
To be continued in the next part
Я всегда нахожу полезную информацию на досках объявлений в своем районе.
Мы предлагаем сделать «ссылочный прогон» для вашего сайта. О нас: Мы являемся компанией, более 10-ти лет предоставляющей услуги «ссылочного прогона» (массового размещения ссылок на сторонних сайтах) и хотели бы предложить вам данную услугу. В результате, через 3-5 дней, DR (Domain Rating) рейтинг вашего домена повысится, что положительно отразится на выдаче вашего сайта в Гугле и Яндексе. Если размещать ссылки на регулярной основе, то через 1-3 месяца, также, повысится и Яндекс показатель ИКС сайта. На сегодняшний день, это самый быстрый и недорогой вариант повышения авторитета сайта и улучшения его позиций в выдаче. Стоимость прогона составляет от 2 000 руб. и выше (и зависит от объёма размещаемых ссылок). Подробности см. на нашем сайте https://gototop.ee/ или пишите мне на alexey@gototop.ee Спасибо
SteamLevelU – простой и выгодный способ повысить и поднять уровень аккаунта Steam! Повышайте уровень Стим вместе с нами!
Hi there just wanted to give you a quick heads up. The text in your post seem to be running off the screen in Opera. I’m not sure if this is a formatting issue or something to do with browser compatibility but I thought I’d post to let you know. The layout look great though! Hope you get the issue fixed soon. Cheers
Congratulations, brilliant idea and timely
If some one needs expert view concerning running a blog afterward i recommend him/her to visit this web site, Keep up the fastidious job.
Hi there! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in the same niche. Your blog provided us beneficial information to work on. You have done a extraordinary job!
Thanks for finally writing about >Deployment Recipes Part 1 – Python, Web2py, Apache and Debian – LearnXYZ <Liked it!
I just could not leave your website prior to suggesting that I extremely
loved the usual information a person provide for your guests?
Is going to be back continuously in order to check out new posts
I every time spent my half an hour to read this website’s
articles every day along with a mug of coffee.
Hi Marisa,
Thank you! That’s so nice to learn. 🙂
Hello just wanted to give you a quick heads up.
The text in your post seem to be running off the screen in Opera.
I’m not sure if this is a format issue or something to do with web browser compatibility
but I figured I’d post to let you know. The design look great though!
Hope you get the problem resolved soon. Cheers
I’m really enjoying the theme/design of your blog. Do you ever run into
any internet browser compatibility problems? A few of my blog visitors have complained about my blog not
operating correctly in Explorer but looks great in Opera.
Do you have any advice to help fix this problem?
The theme works best on Chrome. Havent tested on IE yet. Will check it out.
Nice post. I used to be checking continuously this blog and I’m impressed!
Very helpful info specially the closing part 🙂 I deal with such information much.
I was looking for this particular information for a long time.
Thank you and best of luck.
This post really stands out— Thanks!
Hello! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in the same niche.
Your blog provided us valuable information to work on. You have done a marvellous job!
I am glad that you liked it. Thanks a ton!
Hello, yes this article is actually good and I have learned lot of things from it about blogging.
thanks.
I think this is among the most vital info for me. And i am glad reading your article.
But should remark on some general things, The web site
style is ideal, the articles is really great : D. Good job,
cheers
Thank you!
My spouse and I stumbled over here by a different website
and thought I might as well check things out. I like what I see
so now i’m following you. Look forward to exploring your web page again.
Thank you a bunch for sharing this with all people you actually understand what you are speaking
approximately! Bookmarked. Please also consult with my web site =).
We can have a hyperlink exchange arrangement between us
I have recently started a blog, the info you provide on this website has helped me tremendously. Thanks for all of your time & work.
Thank you for your articles. They are very helpful to me. May I ask you a question?
yes please ask the question