Valentine's Day is coming , The majority of male compatriots are going to give girlfriends what gifts ？ masks ？ Lipstick ？ Better use python Write a website to tell her ！ Simple animation + I want to see you bgm, Who else can't ？
Can't python？ I can't write websites ？ As long as you can understand print('hello world') One more computer is enough ,python+Django+php+mysql+html as long as 30 It can be deployed in minutes , It can not only capture the heart of a girl, but also learn to program . What are we waiting for? , Let's get started .
A computer （Windows、mac All possible , Little bully can't ）
One server （ Deploy to the server to make ta You can see it everywhere , Or send your computer to ta see ？）
Basic programming knowledge （ Can understand
print('hello world')That's enough ）
Related software ：navicat,anaconda,mysql,filezilla etc. （ If not, I need to review my previous articles ）
In a nutshell , There are only three steps
To configure Django
To configure php
Revise the relevant copy 、bgm.
Just like the previous deployment of the epidemic tracking page , The first page of this confession uses html+css+js Make , No, it's okay. , As long as the basic line of code configuration, and then directly upload the entire source code . The second page uses php Make , No, it doesn't matter , It's still configured php Environmental Science , Source code ( At the end of the article ) Just upload the whole thing . Two pages need to deploy the environment in my previous articles have detailed fool tutorial guidance , So this article will skip .
One last word , Because the author is equivalent to writing from the perspective of God , And it's normal that Xiaobai or even Xiaobai can't understand some places for the first time , If there is any doubt or an unsolvable error , Welcome to leave a message .
To configure Django
Please make sure that your mysql、 Alibaba cloud security group deployment is completed according to the configuration in the previous article .
First filezilla Software ftp Connect to your own server ,ssh Also remotely connect to your own server , then cd Go to the root , perform
django-admin startproject love
filezilla Refresh the directory and find one in many places love Folder execution
The representative entered love Folder , Re execution
python manage.py startapp web
And then I'll download Django Source inside the whole love The folder uses filezilla Overlay upload to previous Directory （ Cover the first one love）. then love Inside setting.py Download to local , Just change the database password inside to your database password . And then upload and overlay the original file .
thus Django It's almost done . Finally, execute
nohup python manage.py runserver 0.0.0.0:8000 &
Of course, make sure that you add 8000 port .（ I won't read the previous article , Stupid tutorial ）
thus , The first page is ok 了 . Browser open
ip:8000 You can view it . Next, let's look at configuring the second page
To configure PHP
Download the whole php Source code .
First ssh Connect to your own server . Then perform the following code installation apache
yum install httpd
Next use filezille Software ftp Connect to your own server and find
/etc/httpd/conf/httpd.conf Download the file locally , Then open it and make the following changes
#ServerName www.example.com:80 Change it to ServerName ip:8080
Listen:80 Change it to Listen:8080
It means to open 8080 port . After modification, it will be uploaded to the original directory .
Next, open the alicloud management console , take 8080 Add port to security group . Then go back to the command line and restart httpd service
systemctl start httpd.service
php Environmental installation
yum -y install php
Then install the dependent services
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-mysql
So far it's done , By default , Yours php The file root directory is
Only need to php Source code filezilla Upload it to this folder and type it into your browser
You can see the website . Of course, the second page is opened in the first page , So the test opens successfully and it's over .
Change the text
thus , The two websites are all deployed , You need to change the text , This is even easier , The first page is related to index.html The related content of the second page in index.php in . Just open it with an editor and you can see the source code , Just change it to the text you want , Of course, if you have more front-end knowledge, you can add it freely / Modify the style 、 Animation and so on .