|
@@ -22,30 +22,30 @@ To serve your images, set up a Backblaze B2 storage following these steps:
|
|
|
|
|
|
1. Visit the Backblaze [website](https://www.backblaze.com) in your browser.
|
|
|
2. Click **Products** from the top navigation and then select **B2 Cloud Storage** from the dropdown.
|
|
|
-3. Sign up to Backblaze B2 Cloud Storage by following these steps:
|
|
|
+3. Sign up to Backblaze B2 Cloud Storage by following these steps:
|
|
|
|
|
|
a. Enter your email address and password.
|
|
|
b. Select the appropriate region.
|
|
|
- c. Click **Sign Up Now**.
|
|
|
+ c. Click **Sign Up Now**.
|
|
|
|
|
|
-4. Verify your email by following these steps:
|
|
|
+4. Verify your email by following these steps:
|
|
|
|
|
|
a. Go to **Account > My Settings** in your side navigation.
|
|
|
b. Click **Verify Email** in the **Security section**.
|
|
|
c. Enter your sign-up email address and then click send **Send Code**.
|
|
|
d. Check your email inbox or spam folder for the verification email.
|
|
|
- e. Click the verification link or use the verification code.
|
|
|
+ e. Click the verification link or use the verification code.
|
|
|
|
|
|
5. Create a Bucket by going to **B2 Cloud Storage > Bucket** and clicking **Create a Bucket**.
|
|
|
6. Go to **B2 Cloud Storage > Bucket** and then click **Create a Bucket**.
|
|
|
7. Add your Bucket information as follows:
|
|
|
|
|
|
-| Bucket information | Instruction |
|
|
|
-| -------- | ------- |
|
|
|
-| Bucket Unique Name | Use a unique Bucket name. For example,_yourname-wagtail-portfolio_ |
|
|
|
-| Files in Bucket are | Select **Public** |
|
|
|
-| Default Encryption | Select **Disable** |
|
|
|
-| Object Lock | Select **Disable** |
|
|
|
+| Bucket information | Instruction |
|
|
|
+| ------------------- | ------------------------------------------------------------------ |
|
|
|
+| Bucket Unique Name | Use a unique Bucket name. For example,_yourname-wagtail-portfolio_ |
|
|
|
+| Files in Bucket are | Select **Public** |
|
|
|
+| Default Encryption | Select **Disable** |
|
|
|
+| Object Lock | Select **Disable** |
|
|
|
|
|
|
8. Click **Create a Bucket**.
|
|
|
|
|
@@ -90,16 +90,16 @@ DJANGO_SETTINGS_MODULE=mysite.settings.production
|
|
|
|
|
|
The next step is to provide values for your environment variables. In your `.env.production` file, use your Backblaze B2 bucket information as values for your environment variables as follows:
|
|
|
|
|
|
-| Environment variable | Instruction |
|
|
|
-| -------- | ------- |
|
|
|
-| AWS_STORAGE_BUCKET_NAME | Use your Backblaze B2 bucket name |
|
|
|
-| AWS_S3_ENDPOINT_URL | Use the Backblaze B2 endpoint URL. For example, _https://s3.us-east-005.backblazeb2.com_ |
|
|
|
-| AWS_S3_REGION_NAME | Determine your bucket's region from the endpoint URL. For example, if your endpoint URL is _s3.us-east-005.backblazeb2.com_, then your bucket's region is _us-east-005_ |
|
|
|
-| AWS_S3_ACCESS_KEY_ID | Leave this empty for now |
|
|
|
-| AWS_S3_SECRET_ACCESS_KEY | Leave this empty for now |
|
|
|
-| DJANGO_ALLOWED_HOSTS | Leave this empty for now |
|
|
|
-| DJANGO_CSRF_TRUSTED_ORIGINS | Use _https://_ |
|
|
|
-| DJANGO_SETTINGS_MODULE | Use _mysite.settings.production_ |
|
|
|
+| Environment variable | Instruction |
|
|
|
+| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
+| AWS_STORAGE_BUCKET_NAME | Use your Backblaze B2 bucket name |
|
|
|
+| AWS_S3_ENDPOINT_URL | Use the Backblaze B2 endpoint URL. For example, _https://s3.us-east-005.backblazeb2.com_ |
|
|
|
+| AWS_S3_REGION_NAME | Determine your bucket's region from the endpoint URL. For example, if your endpoint URL is _s3.us-east-005.backblazeb2.com_, then your bucket's region is _us-east-005_ |
|
|
|
+| AWS_S3_ACCESS_KEY_ID | Leave this empty for now |
|
|
|
+| AWS_S3_SECRET_ACCESS_KEY | Leave this empty for now |
|
|
|
+| DJANGO_ALLOWED_HOSTS | Leave this empty for now |
|
|
|
+| DJANGO_CSRF_TRUSTED_ORIGINS | Use _https://_ |
|
|
|
+| DJANGO_SETTINGS_MODULE | Use _mysite.settings.production_ |
|
|
|
|
|
|
In the preceding table, you didn't provide values for your `AWS_S3_ACCESS_KEY_ID`, `AWS_S3_SECRET_ACCESS_KEY`, and `DJANGO_ALLOWED_HOSTS`.
|
|
|
|
|
@@ -110,22 +110,22 @@ To get values for your `AWS_S3_ACCESS_KEY_ID` and `AWS_S3_SECRET_ACCESS_KEY`, fo
|
|
|
3. Click **Add a New Application Key**.
|
|
|
4. Configure the application key settings as follows:
|
|
|
|
|
|
-| Setting | Instruction |
|
|
|
-| -------- | ------- |
|
|
|
-| Name of Key | Provide a unique name |
|
|
|
-| Allow access to Buckets | Choose the Backblaze B2 bucket you created earlier |
|
|
|
-| Type of Access | Select **Read and Write** |
|
|
|
-| Allow List All Bucket Names | Leave this unticked |
|
|
|
-| File name prefix | Leave field empty |
|
|
|
-| Duration (seconds) | Leave field empty |
|
|
|
+| Setting | Instruction |
|
|
|
+| --------------------------- | -------------------------------------------------- |
|
|
|
+| Name of Key | Provide a unique name |
|
|
|
+| Allow access to Buckets | Choose the Backblaze B2 bucket you created earlier |
|
|
|
+| Type of Access | Select **Read and Write** |
|
|
|
+| Allow List All Bucket Names | Leave this unticked |
|
|
|
+| File name prefix | Leave field empty |
|
|
|
+| Duration (seconds) | Leave field empty |
|
|
|
|
|
|
5. Click **Create New Key**.
|
|
|
|
|
|
Now, use your `keyID` as the value of `AWS_S3_ACCESS_KEY_ID` and `applicationKey` for `AWS_S3_SECRET_ACCESS_KEY` in your `.env.production` file:
|
|
|
|
|
|
-| Environment variable | Instruction |
|
|
|
-| -------- | ------- |
|
|
|
-| AWS_S3_ACCESS_KEY_ID | Use your **keyID** |
|
|
|
+| Environment variable | Instruction |
|
|
|
+| ------------------------ | --------------------------- |
|
|
|
+| AWS_S3_ACCESS_KEY_ID | Use your **keyID** |
|
|
|
| AWS_S3_SECRET_ACCESS_KEY | Use your **applicationKey** |
|
|
|
|
|
|
At this stage, the content of your `.env.production` file looks like this:
|
|
@@ -218,16 +218,16 @@ If you successfully install flyctl but get an error saying "`fly` is not recogni
|
|
|
|
|
|
8. Create your Fly.io project by running `fly launch` and answering the resulting prompt questions as follows:
|
|
|
|
|
|
-| Question | Instruction |
|
|
|
-| -------- | ------- |
|
|
|
-| Choose an app name | Enter a name of your choice. For example, _yourname-wagtail-portfolio_ |
|
|
|
-| Choose a region for deployment | Select the region closest to the _AWS_S3_REGION_NAME_ in your _env.production_ file. |
|
|
|
-| Overwrite ".../.dockerignore"? | Enter _y_ |
|
|
|
-| Overwrite ".../Dockerfile"? | Enter _y_ |
|
|
|
-| Would you like to set up a Postgresql database now? | Enter _y_ |
|
|
|
-| Select configuration | select _Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk_ if available. Otherwise, select the smallest configuration option |
|
|
|
-| Scale single node pg to zero after one hour? | Enter _y_ |
|
|
|
-| Would you like to set up an Upstash Redis database now? | Enter _n_ |
|
|
|
+| Question | Instruction |
|
|
|
+| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
+| Choose an app name | Enter a name of your choice. For example, _yourname-wagtail-portfolio_ |
|
|
|
+| Choose a region for deployment | Select the region closest to the _AWS_S3_REGION_NAME_ in your _env.production_ file. |
|
|
|
+| Overwrite ".../.dockerignore"? | Enter _y_ |
|
|
|
+| Overwrite ".../Dockerfile"? | Enter _y_ |
|
|
|
+| Would you like to set up a Postgresql database now? | Enter _y_ |
|
|
|
+| Select configuration | select _Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk_ if available. Otherwise, select the smallest configuration option |
|
|
|
+| Scale single node pg to zero after one hour? | Enter _y_ |
|
|
|
+| Would you like to set up an Upstash Redis database now? | Enter _n_ |
|
|
|
|
|
|
The `fly launch` command creates two new files, `Dockerfile` and `fly.toml`, in your project directory.
|
|
|
|
|
@@ -236,7 +236,7 @@ If you use a third-party app terminal like the Visual Studio Code terminal, you
|
|
|
1. Delete `fly.toml` file from your project directory.
|
|
|
2. Go to your Fly.io account in your browser and click **Dashboard**.
|
|
|
3. Click the created app in your **Apps** list.
|
|
|
-4. Click **Settings** in your side navigation.
|
|
|
+4. Click **Settings** in your side navigation.
|
|
|
5. Click **Delete app**.
|
|
|
6. Enter the name your app.
|
|
|
7. Click **Yes delete it**.
|
|
@@ -397,7 +397,7 @@ except ImportError:
|
|
|
pass
|
|
|
```
|
|
|
|
|
|
-The explanation of some of the code in your `mysite/settings/production.py` file is as follows:
|
|
|
+The explanation of some of the code in your `mysite/settings/production.py` file is as follows:
|
|
|
|
|
|
1. `DEBUG = False` turns off debugging for the production environment. It's important for security and performance.
|
|
|
2. `SECRET_KEY = os.environ["SECRET_KEY"]` retrieves the project's secret key from your environment variable.
|
|
@@ -409,9 +409,9 @@ The explanation of some of the code in your `mysite/settings/production.py` fil
|
|
|
|
|
|
Now, complete the configuration of your environment variables by modifying your `.env.production` file as follows:
|
|
|
|
|
|
-| Environment variable | Instruction |
|
|
|
-| -------- | ------- |
|
|
|
-| DJANGO_ALLOWED_HOSTS | This must match your fly.io project name. For example, _yourname-wagtail-portfolio.fly.dev_ |
|
|
|
+| Environment variable | Instruction |
|
|
|
+| --------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
|
+| DJANGO_ALLOWED_HOSTS | This must match your fly.io project name. For example, _yourname-wagtail-portfolio.fly.dev_ |
|
|
|
| DJANGO_CSRF_TRUSTED_ORIGINS | This must match your project’s domain name. For example, _https://yourname-wagtail-portfolio.fly.dev_ |
|
|
|
|
|
|
The content of your `.env.production` file should now look like this:
|
|
@@ -471,12 +471,12 @@ For more information on how to set up your Django project on Fly.io, read [Djang
|
|
|
|
|
|
All this while, you've been adding content to your site in the local environment. Now that your site is live on a server, you must add content to the live site. To add content to your live site, go to ` https://yourname-wagtail-portfolio.fly.dev/admin/` in your browser and follow the steps in the following sub-sections of the tutorial:
|
|
|
|
|
|
-- [Add content to your homepage](add_content_to_your_homepage)
|
|
|
-- [Add your social media links](add_your_social_media_links)
|
|
|
-- [Add footer text](add_footer_text)
|
|
|
-- [Add pages to your site menu](add_pages_to_your_site_menu)
|
|
|
-- [Add your contact information](add_your_contact_information)
|
|
|
-- [Add your resume](add_your_resume)
|
|
|
+- [Add content to your homepage](add_content_to_your_homepage)
|
|
|
+- [Add your social media links](add_your_social_media_links)
|
|
|
+- [Add footer text](add_footer_text)
|
|
|
+- [Add pages to your site menu](add_pages_to_your_site_menu)
|
|
|
+- [Add your contact information](add_your_contact_information)
|
|
|
+- [Add your resume](add_your_resume)
|
|
|
|
|
|
```{note}
|
|
|
If you encounter errors while trying to access your live site in your browser, check your application logs in your Fly.io Dashboard. To check your application logs, click **Dashboard > Apps > yourname-wagtail-portfolio > Monitoring**
|