Re: Deploying my Django App to Heroku

2021-04-26 Thread Ejike Enyinnaya
Hi Ayser,

Would try that and give feedback.
BR,
Ejike Chiboka
0804537; 08166516400


On Fri, Apr 23, 2021 at 1:10 PM Ayser shuhaib 
wrote:

> Make sure you create the user objects in the database before loading the
> books data
>
> On Fri, 23 Apr 2021 at 14:02, Nzekwe Isaac  wrote:
>
>> I think there's a problem with your database. Try deleting your dbsqlite
>> database and run migrations a again.
>>
>> On Fri, 23 Apr 2021, 12:50 Ejike Enyinnaya, 
>> wrote:
>>
>>> Good day Isaac,
>>>
>>> I ran makemigrations and migrate before deploy as seen in my screenshots
>>> but I am still having the same problem.
>>>
>>> Find attached my screenshots.
>>>
>>> Please what else should i look at?
>>> BR,
>>> Ejike Chiboka
>>> 0804537; 08166516400
>>>
>>>
>>> On Wed, Apr 21, 2021 at 11:44 PM Nzekwe Isaac 
>>> wrote:
>>>
>>>> Try running makemigrations and migrations again before deploying again
>>>>
>>>> On Wed, 21 Apr 2021, 22:30 ejike@gmail.com, <
>>>> ejike.chib...@gmail.com> wrote:
>>>>
>>>>> Good day All,
>>>>>
>>>>> Please I am trying to deploy my App which uses Django/Python as the
>>>>> backend and React as the frontend to Heroku but I keep getting this error
>>>>> in the attached picture.
>>>>>
>>>>> Also attached is a screenshot of my Models.py.
>>>>>
>>>>> I would be very grateful for any assistance.
>>>>>
>>>>> Kind Regards,
>>>>>
>>>>> --
>>>>> 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/287b1a3a-abc5-4848-ade7-2de414e7b549n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/287b1a3a-abc5-4848-ade7-2de414e7b549n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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/CACD%2B4V%3DPmh1OJbEYPW5u6vJG_aovPE-2vnHmwNGQrddbNjqHQg%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CACD%2B4V%3DPmh1OJbEYPW5u6vJG_aovPE-2vnHmwNGQrddbNjqHQg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> 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/CADe59C9cyhquav%2Be-%3Dgh59Kaj2xDeqmnUg0e4vHtJcX1VK8Ztg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CADe59C9cyhquav%2Be-%3Dgh59Kaj2xDeqmnUg0e4vHtJcX1VK8Ztg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CACD%2B4VmnG7WD5%2BrJX7z0ZPjYZ9iPv6Ykc6QZw4Rb6aCDi39veA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CACD%2B4VmnG7WD5%2BrJX7z0ZPjYZ9iPv6Ykc6QZw4Rb6aCDi39veA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAE0AZGKMpOoA6xHsA9j0iWy1X-8hqLM3yJm9rHDV%2BeN2DjJNNg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAE0AZGKMpOoA6xHsA9j0iWy1X-8hqLM3yJm9rHDV%2BeN2DjJNNg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADe59C_1d0Ax82gvSA-Ui65P5a%2BJaAdDgVTUJpNMVWoFJO5hjg%40mail.gmail.com.


Re: Assistance for deploying django app to heroku

2021-04-26 Thread Ejike Enyinnaya
Good day Jim,

My process from beginning includes:

1. I reset the database: rm -f db.sqlite3
2. python manage.py migrate
3. In django admin platform: I added all the books information from the
fixtures.json and tied it to the user which is admin
4. Implemented a new fixtures.json
5. ran python manage.py makemigrations
6. ran python manage.py migrate
7. git add .
8. git commit -m "[updated information here]"
9. git push origin master
10. git push heroku master
11. heroku run python manage.py migrate
12. heroku run python manage.py loaddata books/fixtures.json (This is
where i get the error)


BR,
Ejike Chiboka
0804537; 08166516400


On Sat, Apr 24, 2021 at 9:38 PM Jim Illback  wrote:

> I didn’t see a “createsuperuser" command. Was that done or is it part of
> your fixtures.json load?
>
> Jim
>
> On Apr 24, 2021, at 8:04 AM, Ejike Enyinnaya 
> wrote:
>
> Good day Kasper,
>
> Thanks for your response.
>
> The git commands I put in the email was just to give a summary of what I
> had done and not the full details, that way my email is not too long and
> cumbersome to read.
>
> I can assure you on my CLI, I ran the proper git commands putting in the
> right information and not leaving it empty.
>
> BR,
> Ejike Chiboka
> 0804537; 08166516400
>
>
> On Fri, Apr 23, 2021 at 7:53 PM Kasper Laudrup 
> wrote:
>
>> On 23/04/2021 20.41, Ejike Enyinnaya wrote:
>> > I did a git add ., git commit -m and git push heroku master
>>
>> Not sure if it's related, but it's possible: This is not how you should
>> use revision control (git).
>>
>> You should keep your source files under revision control, not just
>> blindly add everything and committing it with an empty commit message.
>> Then you might as well not use any kind of revision control at all.
>>
>> It might be slightly off topic and not related to your problem, but on
>> the other hand, there's a huge chance that you have added a bunch of
>> stuff like your database file and you have zero way of tracking what you
>> have actually changed.
>>
>> Not sure if this has every worked for you, but if you have a similar
>> problem and it used to work and then suddenly didn't, using revision
>> control like git can be an enormous help.
>>
>> Do yourself a huge favor and learn how to use revision control.
>>
>> 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/4ebee094-cc84-ce01-ddfd-11ca231960d6%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/CADe59C-Sau_rAhxLJQKBmMcHDMxq_Uc12aTVo%2BRL4YoSdOf7aw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CADe59C-Sau_rAhxLJQKBmMcHDMxq_Uc12aTVo%2BRL4YoSdOf7aw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> 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/F91210CE-9D66-4C64-A1A0-1C6EA001DD67%40hotmail.com
> <https://groups.google.com/d/msgid/django-users/F91210CE-9D66-4C64-A1A0-1C6EA001DD67%40hotmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CADe59C9qFczEWktkZ%3DwRnc%3Djpkx4QA9ignYmqx2hy%2B86Omj_4w%40mail.gmail.com.


Re: Assistance for deploying django app to heroku

2021-04-24 Thread Ejike Enyinnaya
Good day Kasper,

Thanks for your response.

The git commands I put in the email was just to give a summary of what I
had done and not the full details, that way my email is not too long and
cumbersome to read.

I can assure you on my CLI, I ran the proper git commands putting in the
right information and not leaving it empty.

BR,
Ejike Chiboka
0804537; 08166516400


On Fri, Apr 23, 2021 at 7:53 PM Kasper Laudrup 
wrote:

> On 23/04/2021 20.41, Ejike Enyinnaya wrote:
> > I did a git add ., git commit -m and git push heroku master
>
> Not sure if it's related, but it's possible: This is not how you should
> use revision control (git).
>
> You should keep your source files under revision control, not just
> blindly add everything and committing it with an empty commit message.
> Then you might as well not use any kind of revision control at all.
>
> It might be slightly off topic and not related to your problem, but on
> the other hand, there's a huge chance that you have added a bunch of
> stuff like your database file and you have zero way of tracking what you
> have actually changed.
>
> Not sure if this has every worked for you, but if you have a similar
> problem and it used to work and then suddenly didn't, using revision
> control like git can be an enormous help.
>
> Do yourself a huge favor and learn how to use revision control.
>
> 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/4ebee094-cc84-ce01-ddfd-11ca231960d6%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/CADe59C-Sau_rAhxLJQKBmMcHDMxq_Uc12aTVo%2BRL4YoSdOf7aw%40mail.gmail.com.


Re: Assistance for deploying django app to heroku

2021-04-24 Thread Ejike Enyinnaya
Good day Kasper,

Hi Kasper,

Thanks for your response. The "git" commands I put in the email was not
just to give any one an idea of what commands I had run but on my CLI, I
ran the proper git commands with the proper messages and not leaving it
empty.
BR,
Ejike Chiboka
0804537; 08166516400


On Fri, Apr 23, 2021 at 7:53 PM Kasper Laudrup 
wrote:

> On 23/04/2021 20.41, Ejike Enyinnaya wrote:
> > I did a git add ., git commit -m and git push heroku master
>
> Not sure if it's related, but it's possible: This is not how you should
> use revision control (git).
>
> You should keep your source files under revision control, not just
> blindly add everything and committing it with an empty commit message.
> Then you might as well not use any kind of revision control at all.
>
> It might be slightly off topic and not related to your problem, but on
> the other hand, there's a huge chance that you have added a bunch of
> stuff like your database file and you have zero way of tracking what you
> have actually changed.
>
> Not sure if this has every worked for you, but if you have a similar
> problem and it used to work and then suddenly didn't, using revision
> control like git can be an enormous help.
>
> Do yourself a huge favor and learn how to use revision control.
>
> 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/4ebee094-cc84-ce01-ddfd-11ca231960d6%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/CADe59C9EojiHJ6fCj%2BJgMgfjThmUSrLBiwgEd4RQgoX7%2BTmAKQ%40mail.gmail.com.


Re: Assistance for deploying django app to heroku

2021-04-23 Thread Ejike Enyinnaya
Hi Guys,

This is the error I am getting:

(first_django_app) ➜  first_django_app git:(master)  heroku run python
manage.py loaddata books/fixtures.json
Running python manage.py loaddata books/fixtures.json on ⬢ gotbooksapp...
up, run.6617 (Free)
Traceback (most recent call last):
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 82, in _execute
return self.cursor.execute(sql)
psycopg2.errors.ForeignKeyViolation: insert or update on table "books_book"
violates foreign key constraint
"books_book_user_id_4b809191_fk_auth_user_id"
DETAIL:  Key (user_id)=(1) is not present in table "auth_user".


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in 
main()
  File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py",
line 419, in execute_from_command_line
utility.execute()
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py",
line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py",
line 354, in run_from_argv
self.execute(*args, **cmd_options)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/base.py",
line 398, in execute
output = self.handle(*args, **options)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/loaddata.py",
line 78, in handle
self.loaddata(fixture_labels)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/core/management/commands/loaddata.py",
line 131, in loaddata
connection.check_constraints(table_names=table_names)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/postgresql/base.py",
line 285, in check_constraints
cursor.execute('SET CONSTRAINTS ALL IMMEDIATE')
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 98, in execute
return super().execute(sql, params)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 66, in execute
return self._execute_with_wrappers(sql, params, many=False,
executor=self._execute)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 84, in _execute
return self.cursor.execute(sql, params)
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line
90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
  File
"/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py",
line 82, in _execute
return self.cursor.execute(sql)
django.db.utils.IntegrityError: Problem installing fixtures: insert or
update on table "books_book" violates foreign key constraint
"books_book_user_id_4b809191_fk_auth_user_id"
DETAIL:  Key (user_id)=(1) is not present in table "auth_user".

I have done the following: rm -f db.sqlite3
run python manage.py makemigrations
run python manage.py migrate
I had to add all the information again as the database had been cleaned out
I then implement fixtures.json locally
I did a git add ., git commit -m and git push heroku master
I did run heroku run python manage.py migrate
I finally run python manage.py loaddata books/fixtures.json
I still have the same errors again

BR,

Ejike Chiboka
0804537; 08166516400


On Fri, Apr 23, 2021 at 7:28 PM Sujayeendra G 
wrote:

>
> Hi,
>
> You can see IntegrityError: fixtures you are updating trying to find user
> with user_id=1 which are not available in your db. Try to create one user
> and migrate again. Or if the App is still in the development stage. Delete
> DB and migrate again. It may work.
>
> Thank you
>
> Regards
> Sujay
>
>
> On Fri, 23 Apr 2021 at 17:25, ejike@gmail.com 
> wrote:
>
>> Good day All,
>>
>> I am trying to deploy my django app to heroku but i keep getting this
>> error in the screenshot attached.
>>
>> Please can anyone assist in me in finding a solution to this and where
>> the issue could be coming from.
>>
>> Looking forward to your replies.
>>
>> Thanks and BR,
>>
>> Ejike
>>
>> --
>> 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/7c7fd9ab-20a6-43f3-9793-06ea0f4220c6n%40googlegroups.com
>> 
>> .
>>
> -

Testing my Django App

2020-03-23 Thread Ejike Enyinnaya
Good day All,

I am currently running a test for my Django app call 'Books'.

Anytime I run an INDEX test, I get the following error below:

"File 
"/Users/macbookpro/.local/share/virtualenvs/first_django_app-mymO4nCn/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py",
 
line 396, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: NOT NULL constraint failed: 
books_book.user_id"

Please can anyone point to what the issue is or what I am doing wrong. 

Thanks and Regards,

-- 
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/6de24eab-953f-49b9-9dc4-7aa65dc9e229%40googlegroups.com.