Migrated code is not working in Django

19 views
Skip to first unread message

Ram

unread,
Feb 8, 2020, 12:26:00 AM2/8/20
to django...@googlegroups.com
Hi,

When we have new code drop from development, we copy the files manually to the hosting server running in Digital Ocean droplet. Then we run these two commands

1. makemigrations
2. migrate

in the python virtual environment.

Both the commands completed find but, we are not able to use the new integration in our web site. We did not touch the database (postgres) side hoping that models.py would take care of migration on the database side.

Please advise what would be missing from my side?

Thanks,
~Ram

DC

unread,
Feb 8, 2020, 12:29:12 AM2/8/20
to django...@googlegroups.com
Hi ram,

What’s is not working ? Like static files? 
Could you share what error you are facing?

Regards, d

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BOi5F31iuhtCDO63rPyt6nOXMY798fQgqorrY%3DwJxEcL36dNg%40mail.gmail.com.

Ram

unread,
Feb 8, 2020, 12:24:00 PM2/8/20
to django...@googlegroups.com
Hello DC,

Thank you for your email. We have added code for user's registration where users use

1. sign up form and submit the form
2. upon submission users get a message about the next steps for activating their registration

Issue # 1 The issue here is users are not getting any activation email
Issue # 2 confirmation message is also incorrect. " Your Registration is successful! Please contact Admin for Emails validation Link " I searched for this message in all files and did not find it.

Here are the code snippets

# signup page
#
def signup_view(request):
   if request.method == 'POST':
       form = CustomerForm(request.POST)
       if form.is_valid():
           cust_item = form.cleaned_data
           print(cust_item)
           saveform = rim_customer(email=cust_item['email'],
                                   reemail=cust_item['reemail'],
                                   password=cust_item['password'],
                                   repassword=cust_item['repassword'],
                                    firstname=cust_item['firstname'],
                                   state=cust_item['state'],
                                   Zip=cust_item['Zip'],
                                   cust_status='0',
                                   mailing=cust_item['mailing'],
                                   referred_by=cust_item['referred_by'])
           saveform.save()

           # Added the code for sending mail when a customer registered here EmailMessage is used from Django
           activate = "<a href=" + url + "/Activate/" + str(saveform.id) + "> Click Here</a>"
           sendMailStaus =  EmailMessage('Registration Confirmation',
                                         "<html>Thank you for registering with us!. You Activation is pending. Please " + activate + "</html>",
                                         settings.EMAIL_HOST_USER,
                                         [cust_item['email']])
           sendMailStaus.content_subtype="html"
           sendMailStaus.send()

           form = CustomerForm()
           return render(request, 'signup.html',{'form':form, 'success': 'mail succesfully send'})
       else:
           messages.error(request, form)
           # return render(request,"form.html", {'error':error})
   else:
       form = CustomerForm()
   return render(request, "signup.html", {'form': form})


 # SiginUp_With_Transaction
    def Popup_signup_view(request):
        if request.method == 'POST':
            form = CustomerForm(request.POST)
            if form.is_valid():
                cust_item = form.cleaned_data
                saveform = rim_customer(email=cust_item['email'], reemail=cust_item['reemail'],
                                        password=cust_item['password'], repassword=cust_item['repassword'],
                                        firstname=cust_item['firstname'], state=cust_item['state'],
                                        Zip=cust_item['Zip'], mailing=cust_item['mailing'], cust_status='0',
                                        referred_by=cust_item['referred_by'])
                saveform.save()
                email = cust_item['email']
                # noinspection PyUnresolvedReferences
                sentMailStatus = sendEmail(email, request, saveform.id)
                form = CustomerForm()
                productid = request.POST['id']
                result = transation_Cast(productid, email)

                if sentMailStatus == True:
                    return HttpResponseRedirect(result)
                else:
                    return HttpResponseRedirect(result)
            else:
                messages.error(request, form)
                # return render(request,"form.html",{'error':error})
        else:
            form = CustomerForm()
        return render(request, "signup.html", {'form': form})

Mail server settings in settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'  # added by me
EMAIL_HOST = 'smtp.gmail.com'
#EMAIL_PORT = 465
EMAIL_USE_TLS = True
#EMAIL_USE_SSL = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'ad...@domain.com'
EMAIL_HOST_PASSWORD = 'domain@123456'

Best regards,
~Ram


Ram

unread,
Feb 8, 2020, 1:03:56 PM2/8/20
to django...@googlegroups.com
Hi,

I just noticed that the migrations table in Postgres is not updated though we reset all the previous migrations. Do I need to run any step in the database side whenever integrate new code drop? Unfortunately, we are not using the GIT method yet to bring over the new code.

Best regards,
~Ram

Integr@te System

unread,
Feb 8, 2020, 2:23:15 PM2/8/20
to django...@googlegroups.com

Ram

unread,
Apr 19, 2020, 12:55:11 PM4/19/20
to django...@googlegroups.com
Thank you, all. Once we started using GIT process for our first code base deployment, we did not see any issue with deployment.

Best regards,
~Ram

Reply all
Reply to author
Forward
0 new messages