Brad

Brad

Programming Phoenix LiveView:

Two things:

1.
The book is written to,. or alludes to the following…

Open up an operating system shell and navigate to the parent directory for your project. Then, type:
mix phx.new pento --live

[pp_liveview] ➔ mix phx.new pento --live * creating pento/config/config.exs

  • creating pento/config/dev.exs
  • creating pento/config/prod.exs

    Fetch and install dependencies? [Yn] Y
  • running mix deps.get

    The mix phx.new command runs the Phoenix installer for a standard Phoenix project, and the --live switch adds the library dependencies, configuration, and assets we’ll need to build live views.

As we work through this book, we’ll point out the bits that this --live switch adds to our project, and we’ll examine the directory structure in detail over time. For now, know that backend code goes in the lib/pento directory, the web- based assets like .css and .js files go in assets, and the web-based code all goes in the lib/pento_web directory.
Create The Database and Run The Server
At the bottom of the installation output, you’ll find a few extra instructions that look something like this:

We are almost there! The following steps are missing:
$ cd pento
$ mix deps.get
$ cd assets && npm install && node node_modules/webpack/bin/webpack.js
–mode development
Then configure your database in config/dev.exs and run:
$ mix ecto.create

I think too many assumptions are made at this step, especially if you are rusty. mix ecto.create errors out. You need to be specific about what those configs need to be set at in config/dev.exs. Also which version of PostgreSQL? A suggestion GUI-driven version probably would be a good idea to help standardize this.

2.
The book above (#1) says one thing but the printout I get from running mix phx.new pento --live produced s slightly different set of instructions at the end of the project generation.

(base) bradhutchins@MacBook-Pro Programming-Phoenix-LiveView % mix phx.new pento --live

  • creating pento/config/config.exs
  • creating pento/config/dev.exs
  • creating pento/config/prod.exs
  • creating pento/config/prod.secret.exs
  • creating pento/config/test.exs
  • creating pento/lib/pento/application.ex
  • creating pento/lib/pento.ex
  • creating pento/lib/pento_web/channels/user_socket.ex
  • creating pento/lib/pento_web/views/error_helpers.ex
  • creating pento/lib/pento_web/views/error_view.ex
  • creating pento/lib/pento_web/endpoint.ex
  • creating pento/lib/pento_web/router.ex
  • creating pento/lib/pento_web/telemetry.ex
  • creating pento/lib/pento_web.ex
  • creating pento/mix.exs
  • creating pento/README.md
  • creating pento/.formatter.exs
  • creating pento/.gitignore
  • creating pento/test/support/channel_case.ex
  • creating pento/test/support/conn_case.ex
  • creating pento/test/test_helper.exs
  • creating pento/test/pento_web/views/error_view_test.exs
  • creating pento/lib/pento/repo.ex
  • creating pento/priv/repo/migrations/.formatter.exs
  • creating pento/priv/repo/seeds.exs
  • creating pento/test/support/data_case.ex
  • creating pento/lib/pento_web/templates/layout/root.html.leex
  • creating pento/lib/pento_web/templates/layout/app.html.eex
  • creating pento/lib/pento_web/templates/layout/live.html.leex
  • creating pento/lib/pento_web/views/layout_view.ex
  • creating pento/lib/pento_web/live/page_live.ex
  • creating pento/lib/pento_web/live/page_live.html.leex
  • creating pento/test/pento_web/views/layout_view_test.exs
  • creating pento/test/pento_web/live/page_live_test.exs
  • creating pento/lib/pento_web/gettext.ex
  • creating pento/priv/gettext/en/LC_MESSAGES/errors.po
  • creating pento/priv/gettext/errors.pot
  • creating pento/assets/webpack.config.js
  • creating pento/assets/.babelrc
  • creating pento/assets/js/app.js
  • creating pento/assets/css/app.scss
  • creating pento/assets/package.json
  • creating pento/assets/static/favicon.ico
  • creating pento/assets/css/phoenix.css
  • creating pento/assets/static/images/phoenix.png
  • creating pento/assets/static/robots.txt

Fetch and install dependencies? [Yn] Y

  • running mix deps.get
  • running mix deps.compile
  • running cd assets && npm install && node node_modules/webpack/bin/webpack.js --mode development

We are almost there! The following steps are missing:

$ cd pento

Then configure your database in config/dev.exs and run:

$ mix ecto.create

Start your Phoenix app with:

$ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

$ iex -S mix phx.server

Marked As Solved

SophieDeBenedetto

SophieDeBenedetto

Author of Programming Phoenix LiveView

Thanks for pointing this out @Brad, your feedback is super helpful :slight_smile:

You can look for some updated info on installing and configuring Postgres in the next Beta release. As for seeing slightly different output from the mix phx new pento --live command–that would likely be due to your using a different Phoenix version than the one with which the Pento app is generated. Some added text to clarify that this might be the case for readers will probably help here. Look for that in the upcoming release as well!

Popular Prag Prog topics Top

jon
Some minor things in the paper edition that says “3 2020” on the title page verso, not mentioned in the book’s errata online: p. 186 But...
New
belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
brian-m-ops
#book-python-testing-with-pytest-second-edition Hi. Thanks for writing the book. I am just learning so this might just of been an issue ...
New
AndyDavis3416
@noelrappin Running the webpack dev server, I receive the following warning: ERROR in tsconfig.json TS18003: No inputs were found in c...
New
adamwoolhether
I’m not quite sure what’s going on here, but I’m unable to have to containers successfully complete the Readiness/Liveness checks. I’m im...
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
PragmaticBookshelf
Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
AstonJ
Seems like a lot of people caught it - just wondered whether any of you did? As far as I know I didn’t, but it wouldn’t surprise me if I...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
OvermindDL1
Woooooooo! This is such a huge release for it, and 2 years incoming! In short, the library is now using an updated hyper backend (not j...
New
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
New

Latest in PragProg

View all threads ❯