Attention: Because Rocket is sensitive with compiler and it highly depends on lately nightly compiler, so it’s so easy to fail when compiling this project.
This is my personal blog, and its also my first Rust project.
Install Rust via shell script
curl https://sh.rustup.rs -sSf | sh
After installing, you might need to
Because this project is built on Rocket, and Rocket depends on Rust nightly, so you need change Rust environment to nightly
rustup default nightly
This project use Diesel as Orm framework, so you need to install its command line tool via Rust package manager(eg, Cargo)
cargo install diesel_cli --no-default-features --features postgres
you need to install Postgresql database, and then configure postgresql by following document’s guide
After everything is done, it is time to create table in database for this project, just run
diesel migration run
Set up envirnment variables
In the last step, you need to create a file named
.env in the root of your repository, set up the following envirnment variables, for examples:
DATABASE_URL=postgres://postgres:postgres@localhost/blog STACKOVERFLOW_URL=https://stackoverflow.com/users/5738112/samray GITHUB_URL=https://github.com/ramsayleung/ ERROR_LOG_PATH=/tmp/common-error.log APP_LOG_PATH=/tmp/app-default.log EMAIL_URLfirstname.lastname@example.org SLOGAN="Ramsay's Utopia" SUB_SLOGAN="fn<T:time+joy>(resource: T)-> Ramsay's Blog" DB_NAME=blog DB_USER=username DB_PASSWORD=passwd
Everything is ok, now, launch Rocket:
And open your favourite browser, enter
If you want to login admin page, you could enter
- refactor admin page, it is unacceptedly ugly.