This is a Drupal practice project bootstrapped with Composer.
- It is a simple Drupal web app to display movie list.
- Imports data from a JSON feed TMDB API.
- Create a custom content type called
movie
. - Create a custom cron to fetching JSON data hourly and save data a node.
- Using Bootstrap to implement appearance.
- Create a custom twig to display image that comes from external url.
- Create a admin config page
/admin/config/movies
to modify api url and run cron to fetch data manually. - Create a view to display moive list and set it as a home page.
- User name and password for drupal web app and mysql is
drupal
.
- MacOS Sonoma 14.2.1
- MAMP 6.8.1
- Apache 2.4.54
- PHP 8.2.0
- MySQL 5.7.39
- Composer 2.6.6
- Drupal 10.2.1
-
Move the project to
/Users/YOUR USER NAME/Sites/Drupal-TMDB-main/web
or/Application/MAMP/htdocs/Drupal-TMDB-main/web
. It is depending on your MAMP is free or pro. And then setting document root on MAMP. -
Install all of the dependencies
# composer install
-
Create a database
# /Applications/MAMP/Library/bin/mysql -u root -p
mysql> CREATE DATABASE drupal-tmdb CHARACTER SET utf8 COLLATE utf8mb4_general_ci;
-
Create a user for database
mysql> CREATE USER drupal@localhost IDENTIFIED BY 'drupal'; mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON drupal-tmdb.* TO 'drupal'@'localhost' IDENTIFIED BY 'drupal'; mysql> FLUSH PRIVILEGES;
-
Import database
# /Applications/MAMP/Library/bin/mysql -u root -p drupal-tmdb < ~/Sites/Drupal-TMDB-main/sql/drupal_tmdb.sql
-
Start server on MAMP and open http://localhost/core/install.php with your browser to reinstall Drupal. And you might get messages like below, so you can press
update script
link or open http://localhost/update.php to complete database update.Drupal already installed
- To start over, you must empty your existing database and copy default.sertting.php over settings.php.
- To upgrade an existing installation, proceed to the update script.
- View your existing site.
-
Option steps, because of installing all of dependencies, two custom twigs in bootstrap5 will be reset, so there are two files must copy to the project.
/Drupal-TMDB-main/web/themes/contrib/bootstrap5/templates/views/views-view-grid--movies.html.twig
/Drupal-TMDB-main/web/themes/contrib/bootstrap5/templates/field/field--field-image-url.html.twig