Giter Club home page Giter Club logo

Comments (14)

pvssrikanth avatar pvssrikanth commented on September 28, 2024 1

from hero-app.

ETretyakov avatar ETretyakov commented on September 28, 2024

Hi!

It seems you have generated some new migration file, because I don't have any with such name - "abf1ce0bccc0". I believe it is located by this path "migrations/versions/abf1ce0bccc0.py".

So If you want me to help you, you need:

  1. to provide the content of your migration file "migrations/versions/abf1ce0bccc0.py";
  2. give me the whole log of the error.

Waiting for your response)

from hero-app.

pvssrikanth avatar pvssrikanth commented on September 28, 2024

from hero-app.

ETretyakov avatar ETretyakov commented on September 28, 2024

You have forgot to add .env file to the root of your repository, the content of the .env file should be like this:

# BASE
API_V1_PREFIX="/api/v1"
DEBUG=True
PROJECT_NAME="Heroes App (local)"
VERSION="0.1.0"
DESCRIPTION="The API for Heroes app."

# DATABASE
DB_ASYNC_CONNECTION_STR="postgresql+asyncpg://hero:[email protected]:5436/heroes_db"
DB_ASYNC_TEST_CONNECTION_STR="postgresql+asyncpg://hero:[email protected]:5436/heroes_db_tests"
DB_EXCLUDE_TABLES="[]"

Pay attention to the connection string it should comply with your database settings

from hero-app.

pvssrikanth avatar pvssrikanth commented on September 28, 2024

from hero-app.

ETretyakov avatar ETretyakov commented on September 28, 2024

Well, .env file looks fine.

The error related to the failure of reading environment variables by pydantic Settings. Do you run alembic upgrade head command from the project root directory?

from hero-app.

pvssrikanth avatar pvssrikanth commented on September 28, 2024

from hero-app.

ETretyakov avatar ETretyakov commented on September 28, 2024

Ok, I see the problem.

Use this command to build Docker container: docker build --build-arg ENV_FILE=".env" -t hero-app -f Dockerfile .
And this command to start container: docker run -d -p "8080:80" --name hero-app hero-app

Also pay attention to connection strings, i.e. on Mac OSX database on localhost would look like this: postgresql+asyncpg://hero:[email protected]:5436/heroes_db

from hero-app.

pvssrikanth avatar pvssrikanth commented on September 28, 2024

from hero-app.

pvssrikanth avatar pvssrikanth commented on September 28, 2024

from hero-app.

ETretyakov avatar ETretyakov commented on September 28, 2024

Please tell me what OS do you use, and where is your database located (local, docker, external)?

from hero-app.

pvssrikanth avatar pvssrikanth commented on September 28, 2024

from hero-app.

ETretyakov avatar ETretyakov commented on September 28, 2024
  1. You have opened port 5432 in docker for your database, and 5436 in your .env file, so you need 5432 in your .env file. So the lines should look like this: DB_ASYNC_CONNECTION_STR="postgresql+asyncpg://{your_user}:{your_password}@localhost:5432/heroes_db"
  2. As I understand your issue - you have another app with tables and data in it and you want to migrate the service to fastapi. So you need to create app with fastapi with all tables and then migrate your data from Django database to a new one with.

from hero-app.

pvssrikanth avatar pvssrikanth commented on September 28, 2024

from hero-app.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.