ResidenciaTICBrisa/05_PipelineFinatec

Deploy do projeto

Opened this issue · 1 comments

Descrição

Configurar o sistema para realizar o deploy da aplicação

Tarefas

  • Limpar o projeto para subir somente o necessário
  • Configurar aquivos do projeto
  • Configurar banco postgres
  • Configurar banco oracle
  • Configurar servidor apache
  • Com o domínio, configurar apache e https
  • Testar site com a FINATEC

Configurações do ip

settings.py

  • ALLOWED_HOSTS = ['ip']
  • python3 project/manage.py runserver 0.0.0:8000

Apache

Incial

  • apt install apache2 libapache2-mod-wsgi-py3
  • http://ip/ (sem a porta) -> visualiza se esta funcionando
  • etc/apache2/sites-available ---> 000-default.conf
<VirtualHost *:80>

	ErrorLog /home/05_PipelineFinatec/site/logs/error.log
	CustomLog /home/05_PipelineFinatec/site/logs/access.log combined

	<Directory /home/05_PipelineFinatec/project/project>
		Require all granted
	</Directory>

	WSGIDaemonProcess project python-home=/home/05_PipelineFinatec/venv python-path=/home/05_PipelineFinatec/project
	WSGIProcessGroup project
	WSGIScriptAlias / /home/05_PipelineFinatec/project/project/wsgi.py

</VirtualHost>
  • apachectl configtest (testa se esta ok)
  • service apache2 restart
  • tail -f /home/05_PipelineFinatec/site/logs/access.log (segue os erros, se tiver)

STATIC

  • site → public → static
  • os arquivos devem estar em um endereço único, foi preciso adaptar as pastar do projeto
  • settings.py:
STATIC_URL = '/static/'
STATIC_ROOT = '/home/05_PipelineFinatec/site/public/static'
MEDIA_ROOT = 'home/05_PipelineFinatec/site/public/static/imagem'
  • python3 project/manage.py collectstatic ----> yes
<VirtualHost *:80>

	ErrorLog /home/05_PipelineFinatec/site/logs/error.log
	CustomLog /home/05_PipelineFinatec/site/logs/access.log combined

	alias /static /home/05_PipelineFinatec/site/public/static
	<Directory /home/05_PipelineFinatec/site/public/static>
		Require all granted
	</Directory>

	alias /static /home/05_PipelineFinatec/site/public/static/imagem
	<Directory /home/05_PipelineFinatec/site/public/static/imagem>
		Require all granted
	</Directory>

	<Directory /home/05_PipelineFinatec/project/project>
		Require all granted
	</Directory>

	WSGIDaemonProcess project python-home=/home/05_PipelineFinatec/venv python-path=/home/05_PipelineFinatec/project
	WSGIProcessGroup project
	WSGIScriptAlias / /home/05_PipelineFinatec/project/project/wsgi.py

</VirtualHost>

  • cd /home/05_PipelineFinatec/site
  • chown -R www-data:www-data public/
  • service apache2 restart