django.db.utils.OperationalError: (2002, 'Can\'t connect to local MySQL server through socket \'/cloudsql/instance:us-central1:project_name\' (2 "No such file or directory")')

2019-08-09 Thread Solomon Mbak
Hi.

For two days I have been stuck on deploying my Django app on Google App 
Engine. I cloned the project from my Github account. I have installed the 
requirements also.

The database in-use is a mysql database 

I get an error that says "django.db.utils.OperationalError: (2002, 'Can\'t 
connect to local MySQL server through socket 
\'/cloudsql/instance:us-central1:project_name\' (2 "No such file or 
directory")')".

I have tried all I can and haven't really found any solutions online.
My database connection looks like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '/cloudsql/instance:us-central1:project',
'USER': 'root',
'PASSWORD': 'password',
'NAME': 'db_name',
}
}

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2e58e307-8490-478f-a8cf-4cf640fde5bc%40googlegroups.com.


Re: I get errors when I try deploying my app on gae

2019-08-07 Thread Solomon Mbak
That was actually it. I got it solved and it's working fine. Thanks a lot.

On Wed, Aug 7, 2019, 8:33 AM Kasper Laudrup  wrote:

> Hi Solomon,
>
> On 06/08/2019 09.27, Solomon Mbak wrote:
> > I have given myself many hours to try and solve this one, all to no
> > avail. I really need some help.
> >
> > My app works perfectly on development environment. When I deploy on
> > Google App Engine, I get series of syntax error.
> >
>
> It would be extremely helpful if you could post the exact syntax error
> you are getting, without that, I can only guess.
>
> >
> > returnHttpResponse(f"{single_slug} doesnt exist at all.")
> > |
> >
> > This error on this piece is on the last line. And the console points to
> > the full-stop on that line.
> >
>
> The "f-string syntax" was introduced in Python 3.6, so I'm guessing
> you're using an older Python version when running in Google App Engine
> which doesn't understand the convenient "f-string syntax".
>
> Hopefully that explains it.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c4c7808a-f3e5-8008-a9e3-8c10847662e7%40stacktrace.dk
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4s2%3D_VFErNEUMwPxVmUjRL947LheoicbLNszLhkcpaOKjLZg%40mail.gmail.com.


Django GAE deployment DATABASE setting

2019-08-07 Thread Solomon Mbak
Hi guys. 

I've spent a few hours on this one, all to no avail. 

I'm trying to reply my Django App on Google App Engine, but I get errors on 
the database connection. I tried configurations as shown below, but it 
still isn't connecting. I need help please;


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'MySQL_db_Name',
'USER': 'root',
'PASSWORD': '',
'HOST': 'project_Name:us-central1:my_DB_instance_Name',
}
}
I really need help. 
Thanks a lot.  

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f394cd26-a9e6-4ee0-8adc-3457b6cd6abb%40googlegroups.com.


I get errors when I try deploying my app on gae

2019-08-06 Thread Solomon Mbak
I have given myself many hours to try and solve this one, all to no avail. 
I really need some help.

My app works perfectly on development environment. When I deploy on Google 
App Engine, I get series of syntax error.


from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import master_courses, course_category, courses_series
from django.contrib import messages
from django.contrib.auth.decorators import login_required




def single_slug(request, single_slug):
categories = [c.course_slug for c in course_category.objects.all()]
if single_slug in categories:
matching_series = courses_series.objects.filter(
course_category__course_slug=single_slug)


series_urls = {}
for ms in matching_series.all():
part_one = master_courses.objects.filter(
course_series__course_series=ms.course_series).earliest("date_added")
series_urls[ms] = part_one.course_slug

return render(request, "main/category.html", {"the_series": 
series_urls})


masterCourses = [m.course_slug for m in master_courses.objects.all()]

return HttpResponse(f"{single_slug} doesnt exist at all.")

This error on this piece is on the last line. And the console points to the 
full-stop on that line.


from django.db import models


# Create your models here.
class Contact(models.Model):
full_name = models.CharField(max_length=150)
email= models.EmailField()
subject  = models.CharField(max_length=200)
message  = models.TextField()


def __str__(self):
return f'{self.full_name} {self.subject}'


The error on that line points to the last line also.

There are a few others like that also. I need some 




-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8b5bf41e-28fc-40ce-b6b1-6efc11b78295%40googlegroups.com.