项目作者: user-cube

项目描述 :
Shop Store Made in Django.
高级语言: HTML
项目地址: git://github.com/user-cube/XPTO_Store.git
创建时间: 2019-10-24T09:45:38Z
项目社区:https://github.com/user-cube/XPTO_Store

开源协议:

下载


XPTO Store

Online Shop Store made with django framework.

Authors

Deploy on Heroku

Primeiro é preciso criar um Procfile:

  1. echo 'web: gunicorn TPW_Proj1.wsgi' > Procfile

Alterar o ficheiro settings.py adicionando no topo:

  1. import django_heroku

E no final do documento acrescentar:

  1. django_heroku.settings(locals())

Adicionar aos requisitos:

  1. django-heroku

Migrate to PostgreSQL

In order to achieve that, do the following steps in order :
```shell script
$ python manage.py dumpdata > db.json

  1. Change the database settings to new database such as of MySQL / PostgreSQL.
  2. ```python
  3. import os
  4. DATABASES = {
  5. 'default': {
  6. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  7. 'NAME': os.getenv('DB_NAME'),
  8. 'USER': os.getenv('DB_USER'),
  9. 'PASSWORD': os.getenv('DB_PASS'),
  10. 'HOST': os.getenv('DB_HOST'),
  11. 'PORT': os.getenv('DB_PORT'),
  12. }
  13. }

Note: We must create an .env file and add the following lines to settings.py

  1. from dotenv import load_dotenv
  2. load_dotenv()

```shell script
$ python manage.py migrate
$ python manage.py shell

  1. Enter the following in the shell
  2. ```python
  3. from django.contrib.contenttypes.models import ContentType
  4. ContentType.objects.all().delete()

After that we only need to load the previous dataset into the new database
shell script $ python manage.py loaddata db.json