Strapi on Digital Ocean app not using production configs - digital-ocean

I've installed a Strapi application using Digital Ocean's App Platform. I'm also using a managed Postgres database. I can deploy with production configurations, however, Strapi is still creating and using the default sqlite database.
I followed Strapi's deployment docs here: https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/digitalocean-app-platform.html#add-a-managed-database
I have set the /config/env/production/database.js and /config/env/production/server.js files. In the console log when the application is being built, it also confirms that it's being run in production mode. I'm not sure why it's ignoring the database.js file though for postgres.

You can try to explicitly set NODE_ENV=production for the container/app's environment.

Related

What is the best way to develop an Elastic Beanstalk Django application locally?

I have recently deployed my Django application on Elastic Beanstalk.
I have everything working now, but I'm curious what the best way to develop locally is.
Currently, after I make a change locally, I have to commit the changes via git and then run eb deploy. This process takes 1-3 minutes which is not ideal for making changes.
The Django application will not run on my local machine, as it is configured for EB.
You are right, having to deploy remotely during development isn't best practice.
Have you considered Docker?
To run a typical Django app locally using Docker, you'll need to dockerize:
The Django app
Database eg Postgres
Worker eg Celery
Local mailer eg Mailhog
Not a very long list.
Obviously you'll add or remove from that list depending on how complex or simple your app is.

Should I use docker in order to be able to run ChomeDriver on Azure Web App Services in Django Server?

Recently I have started a Django server on Azure Web App Service, now I want to add a usage of "ChromoDriver" for web scraping, I have noticed that for that I need to install some additional Linux packages (not python) on the machine. the problem is that it gets erased on every deployment, does it mean that I should switch to Docker ?
Container works, but you can also try to pull down the additional packages in the custom start up file without messing around the machine after the deployment
https://learn.microsoft.com/en-us/azure/developer/python/tutorial-deploy-app-service-on-linux-04

Django Cookiecutter Production Server Setup on DigitalOcean

I am trying to setup my Django Cookiecutter code on an Ubuntu server hosted on Digital Ocean. (My first attempt at such a thing.)
It does not appear that my .env file is loading?
DATABASE_URL=postgres://myapp:pwd123#127.0.0.1:5432/myapp
DJANGO_ALLOWED_HOSTS=187.99.73.187,myapp.com,187.99.73.187:8000
DJANGO_ADMIN_URL=admin
DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_SECRET_KEY=A8fpfkN5}...m5~^jggSo3wq`0Z*
I am using the latest version of Cookiecutter. https://github.com/pydanny/cookiecutter-django
Do I have to do something special to activate/recognize this code?
Right now I am getting an error of add '187.99.73.187' to ALLOWED_HOSTS. But it is in the env file.
I also had Postgres error based on not getting data from this new .env file.
I see instructions and videos for setting up Cookiecutter on Docker, Heroku and PythonAnywhere. Just not for a simple Linux installation.
Thanks.

Django Web application publishing

How to publish django web application? what are the steps to be followed for publishing a django application? is there any free hosting for pulishing?
thanks in advance
I am using PythonAnyWhere for hosting my project. They provide hosting for python-Django / flask specificly and have a very dedicated team.
You can host your app for free but you can not use your own domain. To use custom domain, you need to purchase paid plan starting from $5 per month.
Their customer support is extremly good.
Steps to follow for hosting:
- Make sure your code is production ready i.e. well tested and bug free.
- Separate production and dev settings file. On production you need to set DEBUG=false.
- Push your code to github. Do not commit sensitive information like credentials or api keys. Keep them in .env file.
- Create account on pythonanywhere server and create database.
- Clone the git repo. Complete the web setup step. Edit the wsgio settings file.
- Run migrations. python manage.py migrate.
- Create cache table if any python manage.py createcachetable.
- Collect static files python manage.py collectstatic.
- Reload the web app.
Refer this step by step article to setup a free account and host web app on pythonanywhere server.
I'm a big fan of Amazon Web Services if you want simplicity and automation. You can create a CodeStar project for Django and Elastic Beanstalk. Everything is set up from you, so as soon as you commit code to your github repo (it even can create the repo for you with the elastic beanstalk config files), it builds, tests, then deploys it.
The best part is you can utilize amazon's free-tier level if you are a new member so it's probably going to be free or extremely cheap.
Look here for reference:
https://aws.amazon.com/codestar/faqs/
digitalocean.com is good for hosting. link
I used this for Django 2.0 with python3.

deploy bitnami django

I am quite computer-illiterate, but I have managed to utilize the Django framework on my own machine. I have had an account on Amazon Web Service (AWS) for some time, but it appeared rather complex to set-up and to make use of, so I put it of for a while. Then I decided to give it a try, and it was not so hard as I first thought to load a AMI and connect to the server with PuTTY. But since I were already using BitNami's Django-Stack, I decided to take a look at their hosting offer (which builds on AWS). Since they appeared to offer "one-click deployment", I set up a new server through their interface. But then, it seems like the "one-click deployment"-promise is with regard to the server itself. There does not seem to be any interface for deploying Django projects through their site. Having used PuTTY already, and adding WinSCP to my machine, I can acceess the server and load my Django-code unto the server. But then I am lost. The documentation seems a bit thin (look here).
The crux of this is the following: Can anyone make this part of the process more understandable. I.e., how to deploy a Django project on a Linux server with Apache/mod_WSGI?
The other question is: I want to use Postgres. Am I free to install this on the server. Should I opt for EBM (EMB?) for this, or what is the downside of not having EBM?
I hope I am not too unworthy of your attention, thanks!
how to deploy a Django project on a Linux server with Apache/mod_WSGI The Bitnami AMI already comes with all this configured. Once installed try going to the EC2 public url on the default 8000 port and you will see the demo django project setup there. You can add your own project once you have logged into the machine via putty check the /home/bitnami/ directory for the demo project. Copy your project, configure your database The other question is: I want to use Postgres. Am I free to install this on the server Postgres and Mysql are already installed the same way you would do on your local machine. The in your project do ./manage.py runserver 0.0.0.0:9000 since the 8000 port is already running another application.