*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.
Update(2021-06-10): Since Rocket can compile on stable Rust with v0.5, this project leveraging on Rocket's features can also compile on stable Rust now. Cheers!
This is my personal blog, and its also my first Rust project.
Well, I know there are a lot of alternatives to writing a blog, but I find other languages such as Java, Python, Javascript,Php, are not fancy enough ;-) Kidding, the truth is that I have learned Rust for more that a half years, but I still could not build real some stuff on Rust. Yes, I lack of idea or I not am skillful enough to fulfill my thought. Finally, I decided to rewrite my blog which was built on Github Page and Org-mode.
Install Rust via shell script
curl https://sh.rustup.rs -sSf | shAfter installing, you might need to
source $HOME/.cargo/envBecause this project is built on Rocket, and Rocket depends on Rust nightly, so you need change Rust environment to nightly
rustup default stableThis 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 postgresyou 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 runIn 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 protected]
SLOGAN="Ramsay's Utopia"
SUB_SLOGAN="fn<T:time+joy>(resource: T)-> Ramsay's Blog"
DB_NAME=blog
DB_USER=username
DB_PASSWORD=passwdEverything is ok, now, launch Rocket:
cargo run
And open your favourite browser, enter localhost:1337
If you want to login admin page, you could enter localhost:1337/admin/login
Email: admin
Password: 123456
- refactor admin page, it is unacceptedly ugly.

