Deploy django project using gunicorn

16 views
Skip to first unread message

Yohandy Chiaawanda

unread,
Nov 12, 2018, 9:58:43 AM11/12/18
to Django users
Hello

I am currently following this guide https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 to set up django into digitalocean, and I kinda stuck at one point when I want to use gunicorn
Whenever i type 'gunicorn --bind 0.0.0.0:8003 myproject.wsgi' ,there's always an ImportError showing up
Here's the screenshot showing the error
error01.PNG
And here's the file __init__.py looks like
error02.PNG

Any suggestion and help is really appreciated 



amit pant

unread,
Nov 12, 2018, 10:28:17 AM11/12/18
to django...@googlegroups.com
check your models, might be there is some spelling error.
if you share your models.py file then we could do more help. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a8e3098f-465e-4986-aca3-f4f196645423%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yohandy Chiaawanda

unread,
Nov 12, 2018, 1:51:33 PM11/12/18
to Django users
I delete the models.py file since I am splitting all the models into separated files based on their name and import them in the __init__.py as the 2nd image i post before..
Should I keep the models.py file ? If yes, where should I keep them ? And what the content it should be ? 

Below I attach one of the model that I made
from django.db import models
from rest_framework import serializers

from Retailapp.models.MasterManagement.MasterItem_models import MasterItem
from Retailapp.models.MasterManagement.MasterUOM_models import MasterUOM


class ItemUnitConvercy(models.Model):
    unit_convercy_id = models.BigAutoField(primary_key=True)
    qty_convercy = models.CharField(max_length=50, blank=True)
    master_item_id = models.ForeignKey(MasterItem, on_delete=models.CASCADE)
    uom_id = models.OneToOneField(MasterUOM, on_delete=models.CASCADE)

    class Meta:
        db_table = 'ItemUnitConvercy'
        app_label = 'Retailapp'


class ItemUnitConvercySerializer(serializers.ModelSerializer):
    class Meta:
        model = ItemUnitConvercy
        fields = '__all__'

Reply all
Reply to author
Forward
0 new messages