A Django web application to guide a fun, randomized trip in Japan. The app selects random tourism sites within a specified distance and provides relevant information (descriptions, homepage URLs, Google Maps integration).
Note: Currently optimized for Japanese tourism sites. Select "All" if you are outside of Japan.
- Random tourism site selection within specified radius
- User authentication and trip management
- Activity categorization (Tourism, Food, Lodging)
- Geographic coordinate-based site filtering
- Web scraping for tourism data collection
- Python 3.8 or higher
- Chrome browser (for web scraping functionality)
- Git
-
Clone the repository
git clone <repository-url> cd random-trip
-
Create and activate virtual environment
python -m venv myenv source myenv/bin/activate # On Windows: myenv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up the database
python manage.py makemigrations python manage.py migrate
-
Collect static files
python manage.py collectstatic
-
Start the development server
python manage.py runserver
-
Open your browser and navigate to
http://127.0.0.1:8000/
- Register/Login: Create an account or log in to manage your trips
- Set Location: Enter your current location coordinates
- Choose Radius: Select the search radius in kilometers
- Get Random Site: Click the roulette to get a random tourism site
- Manage Trips: Create and organize your trips with activities
Problem: Django blocks requests from 127.0.0.1:8000.
Solution:
- Add
'127.0.0.1'toALLOWED_HOSTSinconfig/settings.py
Problem: Geolocation fails with error code 2.
Solution:
- macOS: System Preferences → Security & Privacy → Privacy → Location Services
- Enable Location Services
- Allow your browser to access location
- Browser Settings: Allow location access for localhost
- Manual Fallback: Enter coordinates manually when GPS fails
When GPS fails, you can enter coordinates manually:
- Tokyo: 35.6762, 139.6503
- Osaka: 34.6937, 135.5023
- Kyoto: 35.0116, 135.7681
- Yokohama: 35.4437, 139.6380
- Nagoya: 35.1815, 136.9066
random-trip/
├── accounts/ # User authentication app
├── config/ # Django project settings
├── randomtrip/ # Main application
│ ├── python_functions/ # Data processing utilities
│ └── ...
├── static/ # Static files (CSS, JS)
├── templates/ # HTML templates
├── data/ # CSV data files
└── manage.py # Django management script
- Django: Web framework
- Selenium: Web scraping and browser automation
- BeautifulSoup: HTML parsing
- Pandas: Data manipulation
- Geopy/Geocoder: Geographic coordinate services
- NumPy: Numerical computations